class documentation

class BaseModelAdmin:

Known subclasses: django.contrib.admin.ModelAdmin, django.contrib.admin.options.InlineModelAdmin

View In Hierarchy

Functionality common to both ModelAdmin and InlineAdmin.
Method __init__ Undocumented
Method check Undocumented
Method formfield​_for​_choice​_field Get a form Field for a database Field that has declared choices.
Method formfield​_for​_dbfield Hook for specifying the form Field instance for a given database Field instance.
Method formfield​_for​_foreignkey Get a form Field for a ForeignKey.
Method formfield​_for​_manytomany Get a form Field for a ManyToManyField.
Method get​_autocomplete​_fields Return a list of ForeignKey and/or ManyToMany fields which should use an autocomplete widget.
Method get​_empty​_value​_display Return the empty_value_display set on ModelAdmin or AdminSite.
Method get​_exclude Hook for specifying exclude.
Method get​_field​_queryset If the ModelAdmin specifies ordering, the queryset should respect that ordering. Otherwise don't specify the queryset, let the field decide (return None in that case).
Method get​_fields Hook for specifying fields.
Method get​_fieldsets Hook for specifying fieldsets.
Method get​_inlines Hook for specifying custom inlines.
Method get​_ordering Hook for specifying field ordering.
Method get​_prepopulated​_fields Hook for specifying custom prepopulated fields.
Method get​_queryset Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.
Method get​_readonly​_fields Hook for specifying custom readonly fields.
Method get​_sortable​_by Hook for specifying which fields can be sorted in the changelist.
Method get​_view​_on​_site​_url Undocumented
Method has​_add​_permission Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.
Method has​_change​_permission Return True if the given request has permission to change the given Django model instance, the default implementation doesn't examine the obj parameter.
Method has​_delete​_permission Return True if the given request has permission to change the given Django model instance, the default implementation doesn't examine the obj parameter.
Method has​_module​_permission Return True if the given request has any permission in the given app label.
Method has​_view​_or​_change​_permission Undocumented
Method has​_view​_permission Return True if the given request has permission to view the given Django model instance. The default implementation doesn't examine the obj parameter.
Method lookup​_allowed Undocumented
Method to​_field​_allowed Return True if the model associated with this admin should be allowed to be referenced by the specified field.
Class Variable autocomplete​_fields Undocumented
Class Variable exclude Undocumented
Class Variable fields Undocumented
Class Variable fieldsets Undocumented
Class Variable filter​_horizontal Undocumented
Class Variable filter​_vertical Undocumented
Class Variable ordering Undocumented
Class Variable prepopulated​_fields Undocumented
Class Variable radio​_fields Undocumented
Class Variable raw​_id​_fields Undocumented
Class Variable readonly​_fields Undocumented
Class Variable show​_full​_result​_count Undocumented
Class Variable sortable​_by Undocumented
Class Variable view​_on​_site Undocumented
Instance Variable formfield​_overrides Undocumented
def check(self, **kwargs):

Undocumented

def formfield_for_choice_field(self, db_field, request, **kwargs):
Get a form Field for a database Field that has declared choices.
def formfield_for_dbfield(self, db_field, request, **kwargs):

Hook for specifying the form Field instance for a given database Field instance.

If kwargs are given, they're passed to the form Field's constructor.

def formfield_for_foreignkey(self, db_field, request, **kwargs):
Get a form Field for a ForeignKey.
def formfield_for_manytomany(self, db_field, request, **kwargs):
Get a form Field for a ManyToManyField.
def get_autocomplete_fields(self, request):
Return a list of ForeignKey and/or ManyToMany fields which should use an autocomplete widget.
def get_empty_value_display(self):
Return the empty_value_display set on ModelAdmin or AdminSite.
def get_exclude(self, request, obj=None):
Hook for specifying exclude.
def get_field_queryset(self, db, db_field, request):
If the ModelAdmin specifies ordering, the queryset should respect that ordering. Otherwise don't specify the queryset, let the field decide (return None in that case).
def get_fields(self, request, obj=None):
Hook for specifying fields.
def get_fieldsets(self, request, obj=None):
Hook for specifying fieldsets.
def get_inlines(self, request, obj):
Hook for specifying custom inlines.
def get_ordering(self, request):
Hook for specifying field ordering.
def get_prepopulated_fields(self, request, obj=None):
Hook for specifying custom prepopulated fields.
def get_queryset(self, request):
Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.
def get_readonly_fields(self, request, obj=None):
Hook for specifying custom readonly fields.
def get_sortable_by(self, request):
Hook for specifying which fields can be sorted in the changelist.
def get_view_on_site_url(self, obj=None):

Undocumented

def has_add_permission(self, request):
Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.
def has_change_permission(self, request, obj=None):

Return True if the given request has permission to change the given Django model instance, the default implementation doesn't examine the obj parameter.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to change the obj model instance. If obj is None, this should return True if the given request has permission to change any object of the given type.

def has_delete_permission(self, request, obj=None):

Return True if the given request has permission to change the given Django model instance, the default implementation doesn't examine the obj parameter.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the obj model instance. If obj is None, this should return True if the given request has permission to delete any object of the given type.

def has_module_permission(self, request):

Return True if the given request has any permission in the given app label.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to view the module on the admin index page and access the module's index page. Overriding it does not restrict access to the add, change or delete views. Use ModelAdmin.has_(add|change|delete)_permission for that.

def has_view_or_change_permission(self, request, obj=None):

Undocumented

def has_view_permission(self, request, obj=None):

Return True if the given request has permission to view the given Django model instance. The default implementation doesn't examine the obj parameter.

If overridden by the user in subclasses, it should return True if the given request has permission to view the obj model instance. If obj is None, it should return True if the request has permission to view any object of the given type.

def lookup_allowed(self, lookup, value):

Undocumented

def to_field_allowed(self, request, to_field):
Return True if the model associated with this admin should be allowed to be referenced by the specified field.
autocomplete_fields: tuple =

Undocumented

exclude =

Undocumented

fields =

Undocumented

filter_horizontal: tuple =
filter_vertical: tuple =

Undocumented

prepopulated_fields: dict =

Undocumented

radio_fields: dict =
raw_id_fields: tuple =

Undocumented

readonly_fields: tuple =

Undocumented

show_full_result_count: bool =

Undocumented

sortable_by =

Undocumented

view_on_site: bool =

Undocumented

formfield_overrides =

Undocumented