def post(self, userid, args): if args['id']: id = hashids.decode(args['id'])[0] delete_bookmark = bookmark.delete(id=id, user_id=userid) else: return {'message': 'No ID Supplied'}, 404 return {'message': 'Bookmark Deleted'}, 200
def bookmark_context(bookmark_id): bookmark_id = hashids.decode(str(bookmark_id))[0] query = db.session.query(Bookmark.id).filter_by(user=current_user.id, deleted=False).order_by(Bookmark.added_on.desc()).all() count = query.index((bookmark_id,)) + 1 page_num = int(count/(current_user.bookmarks_per_page) + 1) bookmark_id = hashids.encode(bookmark_id) return redirect(url_for('bookmark_list', page=page_num, bid=bookmark_id))
def post(self, userid, args): if args['id']: id = hashids.decode(args['id'])[0] tags = urllib.unquote(args['tags']) tags = tags.split(',') edit_bookmark = bookmark.api_edit(id=id, tags=tags, user_id=userid) else: return {'message': 'No ID Supplied'}, 404 return {'message': 'Bookmark Modified'}, 200
def bookmark_reader(bookmark_id=None): bookmark_id = hashids.decode(str(bookmark_id))[0] bookmarkobj = _get_user_object_or_404(Bookmark, bookmark_id, current_user.id) if bookmarkobj.readability_html is None: return abort(404) else: readable_html = Markup(bookmarkobj.readability_html) return render_template("manager/bookmark_readable.html", readable_html=readable_html, title=bookmarkobj.title, link=bookmarkobj.main_url)
def bookmark_edit(bookmark_id=None): if bookmark_id: bookmark_id = hashids.decode(bookmark_id)[0] bookmarkobj = _get_user_object_or_404(Bookmark, bookmark_id, current_user.id) bookmarkobj.tags_2 = ','.join(bookmarkobj.tags).encode('utf-8') form = EditBookmarkForm(obj=bookmarkobj, csrf_enabled=False) if form.validate_on_submit(): bookmark.edit(id=bookmark_id, title=form.title.data, description=form.description.data, tags=form.tags_1.data, user_id=current_user.id) return redirect(url_for('bookmark_list')) return render_template("manager/bookmark_edit.html", form=form, bookmark_obj=bookmarkobj)
def bookmark_public(bookmark_id): bookmark_id = hashids.decode(bookmark_id)[0] query = Bookmark.query.get(bookmark_id) return render_template("public/bookmark_share.html", bookmark=query)