From 233483c0c48110e6a1b07a1605642c46b0a63e91 Mon Sep 17 00:00:00 2001 From: Michael Hall Date: Tue, 13 Feb 2018 10:33:23 -0200 Subject: [PATCH] Add fields to Team and Event admin site --- events/admin.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/events/admin.py b/events/admin.py index 4b81b8d..ba3e18e 100644 --- a/events/admin.py +++ b/events/admin.py @@ -32,6 +32,11 @@ admin.site.register(Organization, OrgAdmin) class TeamAdmin(admin.ModelAdmin): raw_id_fields = ('country', 'spr', 'city', 'owner_profile', 'admin_profiles', 'contact_profiles') + list_display = ('__str__', 'member_count', 'owner_profile', 'created_date') + ordering = ('-created_date',) + def member_count(self, team): + return team.members.all().count() + member_count.short_description = 'Members' admin.site.register(Team, TeamAdmin) admin.site.register(Searchable) @@ -42,6 +47,11 @@ admin.site.register(Place, PlaceAdmin) class EventAdmin(admin.ModelAdmin): raw_id_fields = ('place', 'created_by') + list_display = ('__str__', 'attendee_count', 'created_by', 'created_time') + ordering = ('-created_time',) + def attendee_count(self, event): + return event.attendees.all().count() + attendee_count.short_description = 'Attendees' admin.site.register(Event, EventAdmin) admin.site.register(Member)