diff --git a/club/models.py b/club/models.py index 06fdbd2e..16d85be9 100644 --- a/club/models.py +++ b/club/models.py @@ -76,7 +76,7 @@ class Club(models.Model): @cached_property def president(self): - return self.members.filter(role=settings.SITH_CLUB_ROLES_ID['President'], start_date__lte=timezone.now()).first() + return self.members.filter(role=settings.SITH_CLUB_ROLES_ID['President'], end_date=None).first() def check_loop(self): """Raise a validation error when a loop is found within the parent list""" @@ -128,12 +128,10 @@ class Club(models.Model): self.save() elif self.page and self.page.name != self.unix_name: self.page.unset_lock() - # self.page.set_lock(root) self.page.name = self.unix_name self.page.save(force_lock=True) elif self.page and self.parent and self.parent.page and self.page.parent != self.parent.page: self.page.unset_lock() - # self.page.set_lock(root) self.page.parent = self.parent.page self.page.save(force_lock=True) diff --git a/club/templates/club/club_list.jinja b/club/templates/club/club_list.jinja index b348a2cc..ba875c89 100644 --- a/club/templates/club/club_list.jinja +++ b/club/templates/club/club_list.jinja @@ -5,10 +5,21 @@ {% endblock %} {% macro display_club(club) -%} -
  • {{ club.name }} + + {% if club.is_active or user.is_root %} + +
  • {{ club.name }} + + {% if not club.is_active %} + ({% trans %}inactive{% endtrans %}) + {% endif %} + {% if club.president %} - {{ club.president.user }}{% endif %} {% if club.short_description %}

    {{ club.short_description|markdown }}

    {% endif %} - {%- if club.children.exclude(is_active=False).all()|length != 0 %} + + {% endif %} + + {%- if club.children.all()|length != 0 %}