Skip to content

Commit

Permalink
Show active blocks on event type admin page
Browse files Browse the repository at this point in the history
  • Loading branch information
rebkwok committed Jan 1, 2024
1 parent 696c787 commit 341aa8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion booking/templatetags/bookingtags.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,4 +452,10 @@ def has_permission(allowed_group, user): # pragma: no cover

@register.filter
def event_types_for_group(allowed_group):
return mark_safe("<br/>".join([f"{event_type.subtype} ({event_type.readable_name})" for event_type in allowed_group.event_types.visible()]))
return mark_safe("<br/>".join([f"{event_type.subtype} ({event_type.readable_name})" for event_type in allowed_group.event_types.visible()]))


@register.filter
def active_block_types(event_type):
active_bts = event_type.blocktype_set.filter(active=True)
return mark_safe("<br/>".join([str(active_bt) for active_bt in active_bts]))
2 changes: 2 additions & 0 deletions templates/studioadmin/setup_event_types.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ <h2>Event Types</h2>
<th class="text-center">Name (subtype)</th>
<th class="text-center">Event Type</th>
<th class="text-center">Allowed Group</th>
<th class="text-center">Purchaseable Blocks</th>
</tr>
</thead>
<tbody>
Expand All @@ -25,6 +26,7 @@ <h2>Event Types</h2>
<td class="text-center studioadmin-tbl">{{ event_type.subtype }}</td>
<td class="text-center studioadmin-tbl">{{ event_type.readable_name }}</td>
<td class="text-center studioadmin-tbl">{% if event_type.allowed_group %}{{ event_type.allowed_group }}{% endif %}</td>
<td class="text-center studioadmin-tbl">{{ event_type|active_block_types }}</td>
</tr>
{% endfor %}
</tbody>
Expand Down

0 comments on commit 341aa8a

Please sign in to comment.