Source code for superdjango.db.primary.admin

# Imports

from django.contrib import admin

# Exports

__all__ = (
    "BasePrimaryAdmin",
)

# Models


[docs]class BasePrimaryAdmin(admin.ModelAdmin): """Add ``is_primary`` to fields and list display/filter."""
[docs] def get_fields(self, request, obj=None): a = super(BasePrimaryAdmin, self).get_fields(request, obj=obj) a.append("is_primary") return a
[docs] def get_list_display(self, request): a = super(BasePrimaryAdmin, self).get_list_display(request) a.append("is_primary") return a
[docs] def get_list_filter(self, request): a = super(BasePrimaryAdmin, self).get_list_display(request) a.append("is_primary") return a