program: fix tag assignment

This commit is contained in:
Lephe 2022-05-19 19:12:09 +01:00
parent 011ea3d2a6
commit 0e1b434f7d
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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):