diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2017-05-23 15:31:07 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2017-05-23 15:31:07 +0200 |
commit | b02a3c469e238892a1c13d32c1e208d35e7885ce (patch) | |
tree | 814abd1cf5e06b139c5978ace289ad2ad20d2c9c /src/web/models/tag.py | |
parent | Removed debug print (diff) | |
download | newspipe-b02a3c469e238892a1c13d32c1e208d35e7885ce.tar.gz newspipe-b02a3c469e238892a1c13d32c1e208d35e7885ce.tar.bz2 newspipe-b02a3c469e238892a1c13d32c1e208d35e7885ce.zip |
Update tags of bookmarks.
Diffstat (limited to 'src/web/models/tag.py')
-rw-r--r-- | src/web/models/tag.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/web/models/tag.py b/src/web/models/tag.py index 70430fa6..ab901cda 100644 --- a/src/web/models/tag.py +++ b/src/web/models/tag.py @@ -21,16 +21,17 @@ class ArticleTag(db.Model): class BookmarkTag(db.Model): - text = db.Column(db.String, primary_key=True, unique=False) - # user_id = db.Column(db.Integer(), db.ForeignKey('user.id')) + id = db.Column(db.Integer, primary_key=True) + text = db.Column(db.String, unique=False) # foreign keys - bookmark_id = db.Column(db.Integer, db.ForeignKey('bookmark.id', ondelete='CASCADE'), - primary_key=True) + user_id = db.Column(db.Integer, db.ForeignKey('user.id')) + bookmark_id = db.Column(db.Integer, db.ForeignKey('bookmark.id', ondelete='CASCADE')) # relationships - bookmark = db.relationship('Bookmark', back_populates='tag_objs', - foreign_keys=[bookmark_id]) + bookmark = db.relationship('Bookmark', back_populates='tags', + cascade="all,delete", foreign_keys=[bookmark_id]) - def __init__(self, text): - self.text = text + # def __init__(self, text, user_id): + # self.text = text + # self.user_id = user_id |