aboutsummaryrefslogtreecommitdiff
path: root/src/web/views
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2017-05-23 23:26:25 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2017-05-23 23:26:25 +0200
commitedfdb4a443ab89d8d0dcb0952aab96423b4544fc (patch)
tree9fb5c6e220cb5bc880a83762ef19f762ec6dc60b /src/web/views
parentremoved a comment (diff)
downloadnewspipe-edfdb4a443ab89d8d0dcb0952aab96423b4544fc.tar.gz
newspipe-edfdb4a443ab89d8d0dcb0952aab96423b4544fc.tar.bz2
newspipe-edfdb4a443ab89d8d0dcb0952aab96423b4544fc.zip
Added database migration script.
Diffstat (limited to 'src/web/views')
-rw-r--r--src/web/views/bookmark.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/web/views/bookmark.py b/src/web/views/bookmark.py
index c3a6e7bd..b5666248 100644
--- a/src/web/views/bookmark.py
+++ b/src/web/views/bookmark.py
@@ -55,25 +55,33 @@ def process_form(bookmark_id=None):
if not form.validate():
return render_template('edit_bookmark.html', form=form)
- tags = []
- for tag in form.tags.data.split(','):
- new_tag = tag_contr.create(text= tag.strip(), user_id= current_user.id)
- tags.append(new_tag)
-
bookmark_attr = {'href': form.href.data,
'description': form.description.data,
'title': form.title.data,
- 'tags': tags,
'shared': form.shared.data,
'to_read': form.to_read.data}
if bookmark_id is not None:
+ tags = []
+ for tag in form.tags.data.split(','):
+ new_tag = tag_contr.create(text=tag.strip(), user_id=current_user.id,
+ bookmark_id=bookmark_id)
+ tags.append(new_tag)
+ bookmark_attr['tags'] = tags
bookmark_contr.update({'id': bookmark_id}, bookmark_attr)
flash(gettext('Bookmark successfully updated.'), 'success')
return redirect(url_for('bookmark.form', bookmark_id=bookmark_id))
# Create a new bookmark
new_bookmark = bookmark_contr.create(**bookmark_attr)
+ tags = []
+ for tag in form.tags.data.split(','):
+ new_tag = tag_contr.create(text=tag.strip(), user_id=current_user.id,
+ bookmark_id=new_bookmark.id)
+ tags.append(new_tag)
+ bookmark_attr['tags'] = tags
+ bookmark_contr.update({'id': new_bookmark.id}, bookmark_attr)
+
flash(gettext('Bookmark successfully created.'), 'success')
bgstack15