|
|
@@ -13,6 +13,20 @@ logic = Blueprint('logic', __name__)
|
|
|
@logic.route('/', methods=['GET', 'POST'])
|
|
|
@login_required
|
|
|
def home():
|
|
|
+
|
|
|
+ # owned groups
|
|
|
+ bgroups = Groups.query.filter_by(owner=current_user.id).all()
|
|
|
+ # owned bookmarks
|
|
|
+ bmarks = Bookmark.query.filter_by(owner=current_user.id).all()
|
|
|
+
|
|
|
+ bb_dic = dict() # dict of lists
|
|
|
+ for bg in bgroups:
|
|
|
+ inter_list = list()
|
|
|
+ for bm in bmarks:
|
|
|
+ if bm.group == bg.group:
|
|
|
+ inter_list.append(bm)
|
|
|
+ bb_dic[bg.group] = inter_list
|
|
|
+
|
|
|
if request.method == "POST":
|
|
|
username = request.form.get('username')
|
|
|
passwd = request.form.get('password')
|
|
|
@@ -46,15 +60,13 @@ def home():
|
|
|
db.session.commit()
|
|
|
flash('Profile Pic updated!', category='success')
|
|
|
|
|
|
- return render_template('home.html', user=current_user)
|
|
|
+ return render_template('home.html', user=current_user, bdic=bb_dic)
|
|
|
|
|
|
@logic.route('/create', methods=['GET', 'POST'])
|
|
|
@login_required
|
|
|
def create():
|
|
|
|
|
|
bgroups = Groups.query.filter_by(owner=current_user.id).all()
|
|
|
- for bg in bgroups:##
|
|
|
- print(bg.group)##
|
|
|
|
|
|
if request.method == 'POST':
|
|
|
wlink = request.form.get('web_link')
|
|
|
@@ -72,7 +84,6 @@ def create():
|
|
|
new_group = Groups(owner=current_user.id, group=wgroup)
|
|
|
db.session.add(new_group)
|
|
|
db.session.add(new_link)
|
|
|
- print(wlink, wname, wgroup, ngroup, wstatus)##
|
|
|
db.session.commit()
|
|
|
flash('New Bookmark added!', category='success')
|
|
|
|