From e3bee43e08f8e5e07819052a372c3a2b1513da1d Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Fri, 28 Jul 2017 13:06:58 +0200 Subject: [PATCH] Improve Fellowship admin form --- scipost/admin.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scipost/admin.py b/scipost/admin.py index 4fe9c27cd..2ff4b9b04 100644 --- a/scipost/admin.py +++ b/scipost/admin.py @@ -182,6 +182,14 @@ def college_fellow_is_active(fellow): '''Check if fellow is currently active.''' return fellow.is_active() +class EditorialCollegeFellowshipAdminForm(forms.ModelForm): + contributor = forms.ModelChoiceField( + queryset=Contributor.objects.order_by('user__last_name')) + + class Meta: + model = EditorialCollegeFellowship + fields = '__all__' + class EditorialCollegeFellowshipAdmin(admin.ModelAdmin): list_display = ('__str__', 'college', college_fellow_is_active) @@ -191,6 +199,7 @@ class EditorialCollegeFellowshipAdmin(admin.ModelAdmin): fields = ('contributor', 'college', 'start_date', 'until_date', 'affiliation', ) college_fellow_is_active.boolean = True + form = EditorialCollegeFellowshipAdminForm admin.site.register(EditorialCollegeFellowship, EditorialCollegeFellowshipAdmin) -- GitLab