aboutsummaryrefslogtreecommitdiff
path: root/src/web/models/bookmark.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2017-05-23 15:31:07 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2017-05-23 15:31:07 +0200
commitb02a3c469e238892a1c13d32c1e208d35e7885ce (patch)
tree814abd1cf5e06b139c5978ace289ad2ad20d2c9c /src/web/models/bookmark.py
parentRemoved debug print (diff)
downloadnewspipe-b02a3c469e238892a1c13d32c1e208d35e7885ce.tar.gz
newspipe-b02a3c469e238892a1c13d32c1e208d35e7885ce.tar.bz2
newspipe-b02a3c469e238892a1c13d32c1e208d35e7885ce.zip
Update tags of bookmarks.
Diffstat (limited to 'src/web/models/bookmark.py')
-rw-r--r--src/web/models/bookmark.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/web/models/bookmark.py b/src/web/models/bookmark.py
index 891c3eda..6eee3cba 100644
--- a/src/web/models/bookmark.py
+++ b/src/web/models/bookmark.py
@@ -28,9 +28,11 @@ __license__ = "GPLv3"
from bootstrap import db
from datetime import datetime
+from sqlalchemy import desc
from sqlalchemy.orm import validates
from sqlalchemy.ext.associationproxy import association_proxy
+from web.models.tag import BookmarkTag
from web.models.right_mixin import RightMixin
@@ -48,11 +50,10 @@ class Bookmark(db.Model, RightMixin):
user_id = db.Column(db.Integer(), db.ForeignKey('user.id'))
# relationships
- tag_objs = db.relationship('BookmarkTag', back_populates='bookmark',
- cascade='all,delete-orphan',
- lazy=False,
- foreign_keys='[BookmarkTag.bookmark_id]')
- tags = association_proxy('tag_objs', 'text')
+ tags = db.relationship(BookmarkTag, backref='of_bookmark', lazy='dynamic',
+ cascade='all,delete-orphan',
+ order_by=desc(BookmarkTag.text))
+ tags_proxy = association_proxy('tags', 'text')
@validates('description')
bgstack15