diff --git a/app/models/post.py b/app/models/post.py index 85d2dea..c272a0e 100644 --- a/app/models/post.py +++ b/app/models/post.py @@ -21,6 +21,9 @@ class Post(db.Model): index=True) author = db.relationship('User', backref="posts", foreign_keys=author_id) + # Tags, for programs and tutorials + tags = db.relationship('Tag', back_populates='post', lazy='joined') + __mapper_args__ = { 'polymorphic_identity': __tablename__, 'polymorphic_on': type diff --git a/app/models/program.py b/app/models/program.py index 7489510..5a0569f 100644 --- a/app/models/program.py +++ b/app/models/program.py @@ -12,15 +12,12 @@ class Program(Post): title = db.Column(db.Unicode(128)) # TODO: Category (games/utilities/lessons) - # TODO: Tags # TODO: Compatible calculator models thread_id = db.Column(db.Integer,db.ForeignKey('thread.id'),nullable=False) thread = db.relationship('Thread', foreign_keys=thread_id, back_populates='owner_program') - tags = db.relationship('Tag', back_populates='post', lazy='joined') - # TODO: Number of views, statistics, attached files, etc def __init__(self, author, title, thread):