diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2017-02-20 01:06:31 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2017-02-20 01:06:31 +0100 |
commit | 4aae47ee918792cf464f33aa6a870453c3091e21 (patch) | |
tree | b52fe86390d86a93ecf6916f355c086a4e5a5abf /src/web/models/bookmark.py | |
parent | wip (diff) | |
download | newspipe-4aae47ee918792cf464f33aa6a870453c3091e21.tar.gz newspipe-4aae47ee918792cf464f33aa6a870453c3091e21.tar.bz2 newspipe-4aae47ee918792cf464f33aa6a870453c3091e21.zip |
wip
Diffstat (limited to 'src/web/models/bookmark.py')
-rw-r--r-- | src/web/models/bookmark.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/web/models/bookmark.py b/src/web/models/bookmark.py index b62285b7..6101a5f0 100644 --- a/src/web/models/bookmark.py +++ b/src/web/models/bookmark.py @@ -34,6 +34,12 @@ from sqlalchemy.ext.associationproxy import association_proxy from web.models.right_mixin import RightMixin +bookmarktags_table = db.Table('bookmarktags', db.metadata, + db.Column('bookmark_id', db.Integer, db.ForeignKey("bookmark.id"), + primary_key=True), + db.Column('tag_text', db.String, db.ForeignKey("BookmarkTag.text"), + primary_key=True) +) class Bookmark(db.Model, RightMixin): """ @@ -49,10 +55,11 @@ 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]') + tag_objs = db.relationship("BookmarkTag", secondary=lambda: bookmarktags_table) + # 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') |