diff --git a/digimarks.py b/digimarks.py index 8a195e7..ba41d36 100644 --- a/digimarks.py +++ b/digimarks.py @@ -37,6 +37,7 @@ class Bookmark(db.Model): url = CharField() created_date = DateTimeField(default=datetime.datetime.now) #image = CharField(default='') + url_hash = CharField() tags = CharField() class Meta: @@ -53,15 +54,26 @@ class Bookmark(db.Model): # if exitcode == 0: # self.image = os.path.join(MEDIA_URL, filename) + def sethash(self): + self.url_hash = hashlib.md5(self.url).hexdigest() + @app.route('/') def index(): return object_list('index.html', Bookmark.select()) + @app.route('//') def bookmarks(userkey): return object_list('bookmarks.html', Bookmark.select()) + +@app.route('//edit/') +def editbookmark(urlhash): + # bookmark = getbyurlhash() + return render_template('edit.html') + + @app.route('//add/') def add(userkey): password = request.args.get('password') @@ -73,6 +85,7 @@ def add(userkey): tags = '' if url: bookmark = Bookmark(url=url, title=title, tags=tags) + bookmark.sethash() #bookmark.fetch_image() bookmark.save() return redirect(url) diff --git a/templates/edit.html b/templates/edit.html new file mode 100644 index 0000000..18d0386 --- /dev/null +++ b/templates/edit.html @@ -0,0 +1,11 @@ + +

Edit/add bookmark

+ +
+ + + + + + +