Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# Imports
3from django.contrib import admin
5# Exports
7__all__ = (
8 "BasePrimaryAdmin",
9)
11# Models
14class BasePrimaryAdmin(admin.ModelAdmin):
15 """Add ``is_primary`` to fields and list display/filter."""
17 def get_fields(self, request, obj=None):
18 a = super(BasePrimaryAdmin, self).get_fields(request, obj=obj)
19 a.append("is_primary")
20 return a
22 def get_list_display(self, request):
23 a = super(BasePrimaryAdmin, self).get_list_display(request)
24 a.append("is_primary")
25 return a
27 def get_list_filter(self, request):
28 a = super(BasePrimaryAdmin, self).get_list_display(request)
29 a.append("is_primary")
30 return a