From d50b58cd244916076a06e7651c0b255e24559dbf Mon Sep 17 00:00:00 2001 From: Lephe Date: Sat, 20 Feb 2021 19:30:18 +0100 Subject: [PATCH] (random improvements on texts) --- app/data/groups.yaml | 6 +++--- app/models/forum.py | 3 ++- app/models/topic.py | 2 ++ app/models/user.py | 14 ++++++-------- app/templates/forum/index.html | 4 ++-- app/templates/widgets/thread.html | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/app/data/groups.yaml b/app/data/groups.yaml index 4e34b0c..97e2b5f 100644 --- a/app/data/groups.yaml +++ b/app/data/groups.yaml @@ -73,6 +73,6 @@ descr: "CreativeCalc est l'association qui gère Planète Casio." privs: access-assoc-board - - name: No login - css: "color: #888888;" - descr: "Compte dont l'accès au site est désactivé." + name: No login + css: "color: #888888;" + descr: "Compte dont l'accès au site est désactivé." diff --git a/app/models/forum.py b/app/models/forum.py index f1cfe60..5e4208a 100644 --- a/app/models/forum.py +++ b/app/models/forum.py @@ -20,7 +20,8 @@ class Forum(db.Model): lazy=True, foreign_keys=parent_id) # Other fields populated automatically through relations: - # List of topics in this exact forum (of type Topic) + # Children forums + # List of topics in this exact forum (of type Topic) # Some configuration TOPICS_PER_PAGE = 30 diff --git a/app/models/topic.py b/app/models/topic.py index abc00bf..a4774d6 100644 --- a/app/models/topic.py +++ b/app/models/topic.py @@ -9,6 +9,8 @@ class Topic(Post): __mapper_args__ = { 'polymorphic_identity': __tablename__, + # Because there is an extra relation to Post (promotion), SQLAlchemy + # cannot guess which Post we inherit from; specify here. 'inherit_condition': id == Post.id } diff --git a/app/models/user.py b/app/models/user.py index e3b7c30..7590e72 100644 --- a/app/models/user.py +++ b/app/models/user.py @@ -20,11 +20,11 @@ import os class User(UserMixin, db.Model): - """ Website user that performs actions on the post """ + """ Any website user, logged in (Member) or not (Guest) """ __tablename__ = 'user' - # User ID, should be used to refer to any user. Thea actual user can either + # User ID, should be used to refer to any user. The actual user can either # be a guest (with IP as key) or a member (with this ID as key). id = db.Column(db.Integer, primary_key=True) # User type (polymorphic discriminator) @@ -55,7 +55,7 @@ class Guest(User): # ID of the [User] entry id = db.Column(db.Integer, db.ForeignKey('user.id'), primary_key=True) # Reusable username, cannot be chosen as the name of a member - # but will be distinguished at rendering time if a member take it later + # but will be distinguished at rendering time if a member takes it later name = db.Column(db.Unicode(User.NAME_MAXLEN)) def __init__(self, name): @@ -66,7 +66,7 @@ class Guest(User): class Member(User): - """ Registered user with full access to the website's services """ + """ Registered user with full access to the site's features """ __tablename__ = 'member' __mapper_args__ = {'polymorphic_identity': __tablename__} @@ -116,10 +116,6 @@ class Member(User): programs = db.relationship('Program') comments = db.relationship('Comment') - # Displayed title - # title_id = db.Column(db.Integer, db.ForeignKey('title.id')) - # title = db.relationship('Title', foreign_keys=title_id) - # Other fields populated automatically through relations: # List of unseen notifications (of type Notification) # Polls created by the member (of class Poll) @@ -152,6 +148,8 @@ class Member(User): db.session.delete(self) db.session.commit() + # Privilege checks + def priv(self, priv): """Check whether the member has the specified privilege.""" if SpecialPrivilege.query.filter_by(mid=self.id, priv=priv).first(): diff --git a/app/templates/forum/index.html b/app/templates/forum/index.html index 769a660..856fdc3 100644 --- a/app/templates/forum/index.html +++ b/app/templates/forum/index.html @@ -9,9 +9,9 @@

Bienvenue sur le forum de Planète Casio ! Vous pouvez créer des nouveaux sujets ou poster des réponses avec un compte - {% if not current_user.is_authenticated %} + {%- if not current_user.is_authenticated %} ou en postant en tant qu'invité - {% endif %} + {%- endif -%} .

diff --git a/app/templates/widgets/thread.html b/app/templates/widgets/thread.html index d929333..e01aa03 100644 --- a/app/templates/widgets/thread.html +++ b/app/templates/widgets/thread.html @@ -13,7 +13,7 @@ {% if c.date_created != c.date_modified %}
Modifié le {{ c.date_modified|date }}
{% endif %} - +