diff --git a/digimarks.py b/digimarks.py index 6ab9650..d052abb 100644 --- a/digimarks.py +++ b/digimarks.py @@ -87,7 +87,7 @@ class Bookmark(db.Model): # if exitcode == 0: # self.image = os.path.join(MEDIA_URL, filename) - def sethash(self): + def set_hash(self): """ Generate hash """ self.url_hash = hashlib.md5(self.url).hexdigest() @@ -136,7 +136,7 @@ class Bookmark(db.Model): def get_tags_for_user(userkey): """ Extract all tags from the bookmarks """ - bookmarks = Bookmark.select(Bookmark.userkey==userkey) + bookmarks = Bookmark.select(Bookmark.userkey == userkey) tags = [] for bookmark in bookmarks: these_tags = bookmark.tags.split(',') @@ -208,7 +208,7 @@ def addingbookmark(userkey): tags = request.form['tags'] if url: bookmark = Bookmark(url=url, title=title, tags=tags, userkey=userkey) - bookmark.sethash() + bookmark.set_hash() #bookmark.fetch_image() if not title: # Title was empty, automatically fetch it from the url, will also update the status code @@ -226,6 +226,13 @@ def addingbookmark(userkey): return redirect(url_for('add')) +@app.route('///delete', methods=['GET', 'POST']) +def deletingbookmark(userkey, urlhash): + """ Delete the bookmark from form submit by /delete """ + # TODO implement + return redirect(url_for('bookmarks', userkey=userkey)) + + @app.route('//tags') def tags(userkey): """ Overview of all tags used by user """ diff --git a/templates/edit.html b/templates/edit.html index 6b0643e..43b9259 100644 --- a/templates/edit.html +++ b/templates/edit.html @@ -46,9 +46,13 @@

+ + {% if bookmark.url_hash %} +

+ {% endif %} {% endblock %}