Verified Commit 96ff2d5c authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Add filter for 'active' and more display fields to committee admin

parent f93d2ab3
...@@ -31,7 +31,8 @@ class CommitteeMembershipInline(admin.StackedInline): ...@@ -31,7 +31,8 @@ class CommitteeMembershipInline(admin.StackedInline):
@admin.register(models.Committee) @admin.register(models.Committee)
class CommitteeAdmin(TranslatedModelAdmin): class CommitteeAdmin(TranslatedModelAdmin):
inlines = (CommitteeMembershipInline,) inlines = (CommitteeMembershipInline,)
list_filter = ('until',) list_display = ('name', 'since', 'until', 'active', 'email')
list_filter = ('until', 'active',)
search_fields = ('name', 'description') search_fields = ('name', 'description')
filter_horizontal = ('permissions',) filter_horizontal = ('permissions',)
...@@ -39,6 +40,13 @@ class CommitteeAdmin(TranslatedModelAdmin): ...@@ -39,6 +40,13 @@ class CommitteeAdmin(TranslatedModelAdmin):
'until', 'contact_mailinglist', 'contact_email', 'until', 'contact_mailinglist', 'contact_email',
'wiki_namespace', 'active') 'wiki_namespace', 'active')
def email(self, instance):
if instance.contact_email:
return instance.contact_email
elif instance.contact_mailinglist:
return instance.contact_mailinglist.name + '@thalia.nu'
return None
def get_queryset(self, request): def get_queryset(self, request):
qs = super().get_queryset(request) qs = super().get_queryset(request)
return qs.exclude(board__is_board=True) return qs.exclude(board__is_board=True)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment