diff --git a/app/models/users.py b/app/models/users.py index 36ea44a..807f847 100644 --- a/app/models/users.py +++ b/app/models/users.py @@ -32,7 +32,8 @@ class User(UserMixin, db.Model): # User type (polymorphic discriminator) type = db.Column(db.String(30)) - # Also a [posts] relationship populated from the Post class. + # Other fields populated automatically through relations: + # relationship populated from the Post class. __mapper_args__ = { 'polymorphic_identity': __tablename__, @@ -106,6 +107,8 @@ class Member(User): # Relations trophies = db.relationship('Trophy', secondary=TrophyMember, back_populates='owners') + topics = db.relationship('Topic') + comments = db.relationship('Comment') # Displayed title # title_id = db.Column(db.Integer, db.ForeignKey('title.id')) diff --git a/app/templates/account/user.html b/app/templates/account/user.html index dc80ac9..147bc76 100644 --- a/app/templates/account/user.html +++ b/app/templates/account/user.html @@ -69,7 +69,7 @@ Création Commentaires - {% for t in member.posts if t.type == "topic" %} + {% for t in member.topics %} {{ t.title }} {{ t.forum.name }}