From 3e4ed6d2dd95e9b770b4e91e8f0b0a3df9248881 Mon Sep 17 00:00:00 2001 From: Virginia Dooley Date: Mon, 25 Sep 2023 12:03:19 +0100 Subject: [PATCH] Add Membership to admin --- ynr/apps/popolo/admin.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ynr/apps/popolo/admin.py b/ynr/apps/popolo/admin.py index c9edfad0c..7b0ca4bcf 100644 --- a/ynr/apps/popolo/admin.py +++ b/ynr/apps/popolo/admin.py @@ -40,5 +40,18 @@ class OrganizationAdmin(admin.ModelAdmin): inlines = generics.BASE_INLINES +class MembershipAdmin(admin.ModelAdmin): + model = models.Membership + list_display = ("person", "party", "get_ballot", "deselected") + fields = ("person", "party", "ballot", "deselected") + readonly_fields = ("person", "party", "ballot") + list_filter = ("deselected",) + + @admin.display(description="Ballot") + def get_ballot(self, obj): + return obj.ballot.ballot_paper_id + + +admin.site.register(models.Membership, MembershipAdmin) admin.site.register(models.Post, PostAdmin) admin.site.register(models.Organization, OrganizationAdmin)