Commit f0a67b7c authored by Luuk Scholten's avatar Luuk Scholten
Browse files

Merge branch '477-filter-on-active-committees-in-admin' into 'master'

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

Closes #477

See merge request !543
parents f93d2ab3 96ff2d5c
......@@ -31,7 +31,8 @@ class CommitteeMembershipInline(admin.StackedInline):
@admin.register(models.Committee)
class CommitteeAdmin(TranslatedModelAdmin):
inlines = (CommitteeMembershipInline,)
list_filter = ('until',)
list_display = ('name', 'since', 'until', 'active', 'email')
list_filter = ('until', 'active',)
search_fields = ('name', 'description')
filter_horizontal = ('permissions',)
......@@ -39,6 +40,13 @@ class CommitteeAdmin(TranslatedModelAdmin):
'until', 'contact_mailinglist', 'contact_email',
'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):
qs = super().get_queryset(request)
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