Skip to content

Commit

Permalink
display minute draft in minutes list for users in that group
Browse files Browse the repository at this point in the history
  • Loading branch information
jeriox committed Aug 20, 2023
1 parent f0adc69 commit 9a06cec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion myhpi/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,13 @@ class MinutesList(BasePage):
subpage_types = ["Minutes"]

def get_visible_minutes(self, request):
minutes_ids = self.get_children().exact_type(Minutes).values_list("id", flat=True)
user_groups = get_user_groups(request.user)
minutes_ids = self.get_children().exact_type(Minutes).values_list("id", flat=True)

# display all minutes including drafts if user is in group that owns the minutes list
if self.group in user_groups:
return Minutes.objects.filter(id__in=minutes_ids).order_by("-date")

minutes_list = (
Minutes.objects.filter(id__in=minutes_ids)
.filter(Q(visible_for__in=user_groups) | Q(is_public=True))
Expand Down
2 changes: 1 addition & 1 deletion myhpi/core/templates/core/minutes_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h3 id="year{{ year }}">{{ year }}</h3>
<td>
{% include "core/label.html" with minutes=minute %}
</td>
<td><a href="{% pageurl minute %}">{{ minute.title }}</a></td>
<td><a href="{% if minute.live %}{% pageurl minute %}{% else %}{% url "wagtailadmin_pages:view_draft" minute.id %}{% endif %}">{{ minute.title }}</a></td>
<td>
{% if minute.attachments.count > 0 %}
<span class="text-gray" data-toggle="tooltip" data-placement="left" data-container="body" title="{{ minute.attachments.all|join:', ' }}">
Expand Down

0 comments on commit 9a06cec

Please sign in to comment.