class ModelAdmin(BaseModelAdmin): (source)
Known subclasses: django.contrib.auth.admin.GroupAdmin
, django.contrib.auth.admin.UserAdmin
, django.contrib.flatpages.admin.FlatPageAdmin
, django.contrib.gis.admin.GeoModelAdmin
, django.contrib.gis.admin.GISModelAdmin
, django.contrib.redirects.admin.RedirectAdmin
, django.contrib.sites.admin.SiteAdmin
Encapsulate all admin options and functionality for a given model.
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | action |
A list_display column containing a checkbox widget. |
Method | add |
Undocumented |
Method | change |
Undocumented |
Method | changeform |
Undocumented |
Method | changelist |
The 'change list' admin view for this model. |
Method | construct |
Construct a JSON structure describing changes from a changed object. |
Method | delete |
Given a model instance delete it from the database. |
Method | delete |
Given a queryset, delete it from the database. |
Method | delete |
Undocumented |
Method | get |
Return a given action from a parameter, which can either be a callable, or the name of a method on the ModelAdmin. Return is a tuple of (callable, name, description). |
Method | get |
Return a list of choices for use in a form object. Each choice is a tuple (name, description). |
Method | get |
Return a dictionary mapping the names of all actions for this ModelAdmin to a tuple of (callable, name, description) for each action. |
Method | get |
Get the initial form data from the request's GET params. |
Method | get |
Return the ChangeList class for use on the changelist page. |
Method | get |
Return a Form class for use in the Formset on the changelist page. |
Method | get |
Return a FormSet class for use on the changelist page if list_editable is used. |
Method | get |
Return a `ChangeList` instance based on `request`. May raise `IncorrectLookupParameters`. |
Method | get |
Hook for customizing the delete process for the delete view and the "delete selected" action. |
Method | get |
Return a Form class for use in the admin add view. This is used by add_view and change_view. |
Method | get |
Undocumented |
Method | get |
Yield formsets and the corresponding inlines. |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | get |
Return a sequence containing the fields to be displayed on the changelist. |
Method | get |
Return a sequence containing the fields to be displayed as links on the changelist. The list_display parameter is the list of fields returned by get_list_display(). |
Method | get |
Return a sequence containing the fields to be displayed as filters in the right sidebar of the changelist page. |
Method | get |
Return a list of fields to add to the select_related() part of the changelist items query. |
Method | get |
Return a dict of all perms for this model. This dict has the keys ``add``, ``change``, ``delete``, and ``view`` mapping to the True/False for each of those actions. |
Method | get |
Return an instance matching the field and value provided, the primary key is used if no field is provided. Return ``None`` if no match is found or the object_id fails validation. |
Method | get |
Undocumented |
Method | get |
Return the preserved filters querystring. |
Method | get |
Return a sequence containing the fields to be searched whenever somebody submits a search query. |
Method | get |
Return a tuple containing a queryset to implement the search and a boolean indicating if the results may contain duplicates. |
Method | get |
Undocumented |
Method | history |
The 'history' admin view for this model. |
Method | log |
Log that an object has been successfully added. |
Method | log |
Log that an object has been successfully changed. |
Method | log |
Log that an object will be deleted. Note that this method must be called before the deletion. |
Method | message |
Send a message to the user. The default implementation posts a message using the django.contrib.messages backend. |
Method | render |
Undocumented |
Method | render |
Undocumented |
Method | response |
Handle an admin action. This is called if a request is POSTed to the changelist; it returns an HttpResponse if the action was handled, and None otherwise. |
Method | response |
Determine the HttpResponse for the add_view stage. |
Method | response |
Determine the HttpResponse for the change_view stage. |
Method | response |
Determine the HttpResponse for the delete_view stage. |
Method | response |
Figure out where to redirect after the 'Save' button has been pressed when adding a new object. |
Method | response |
Figure out where to redirect after the 'Save' button has been pressed when editing an existing object. |
Method | save |
Given a ModelForm return an unsaved instance. ``change`` is True if the object is being changed, and False if it's being added. |
Method | save |
Given an inline formset save it to the database. |
Method | save |
Given a model instance save it to the database. |
Method | save |
Given the ``HttpRequest``, the parent ``ModelForm`` instance, the list of inline formsets and a boolean value based on whether the parent is being added or changed, save the related objects to the database... |
Class Variable | actions |
Undocumented |
Class Variable | actions |
Undocumented |
Class Variable | actions |
Undocumented |
Class Variable | actions |
Undocumented |
Class Variable | add |
Undocumented |
Class Variable | change |
Undocumented |
Class Variable | change |
Undocumented |
Class Variable | date |
Undocumented |
Class Variable | delete |
Undocumented |
Class Variable | delete |
Undocumented |
Class Variable | inlines |
Undocumented |
Class Variable | list |
Undocumented |
Class Variable | list |
Undocumented |
Class Variable | list |
Undocumented |
Class Variable | list |
Undocumented |
Class Variable | list |
Undocumented |
Class Variable | list |
Undocumented |
Class Variable | list |
Undocumented |
Class Variable | object |
Undocumented |
Class Variable | popup |
Undocumented |
Class Variable | preserve |
Undocumented |
Class Variable | save |
Undocumented |
Class Variable | save |
Undocumented |
Class Variable | save |
Undocumented |
Class Variable | search |
Undocumented |
Class Variable | search |
Undocumented |
Instance Variable | admin |
Undocumented |
Instance Variable | model |
Undocumented |
Instance Variable | opts |
Undocumented |
Property | media |
Undocumented |
Property | urls |
Undocumented |
Static Method | _get |
Undocumented |
Method | _changeform |
Undocumented |
Method | _create |
Helper function to generate formsets for add/change_view. |
Method | _delete |
The 'delete' admin view for this model. |
Method | _filter |
Filter out any actions that the user doesn't have access to. |
Method | _get |
Return the list of actions, prior to any request-based filtering. |
Method | _get |
Return POST data values of list_editable primary keys. |
Method | _get |
Undocumented |
Method | _get |
Based on POST data, return a queryset of the objects that were edited via list_editable. |
Method | _get |
Create a message informing the user that the object doesn't exist and return a redirect to the admin index page. |
Method | _response |
Undocumented |
Inherited from BaseModelAdmin
:
Method | check |
Undocumented |
Method | formfield |
Get a form Field for a database Field that has declared choices. |
Method | formfield |
Hook for specifying the form Field instance for a given database Field instance. |
Method | formfield |
Get a form Field for a ForeignKey. |
Method | formfield |
Get a form Field for a ManyToManyField. |
Method | get |
Return a list of ForeignKey and/or ManyToMany fields which should use an autocomplete widget. |
Method | get |
Return the empty_value_display set on ModelAdmin or AdminSite. |
Method | get |
Hook for specifying exclude. |
Method | get |
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 |
Hook for specifying fields. |
Method | get |
Hook for specifying fieldsets. |
Method | get |
Hook for specifying custom inlines. |
Method | get |
Hook for specifying field ordering. |
Method | get |
Hook for specifying custom prepopulated fields. |
Method | get |
Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view. |
Method | get |
Hook for specifying custom readonly fields. |
Method | get |
Hook for specifying which fields can be sorted in the changelist. |
Method | get |
Undocumented |
Method | has |
Return True if the given request has permission to add an object. Can be overridden by the user in subclasses. |
Method | has |
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 |
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 |
Return True if the given request has any permission in the given app label. |
Method | has |
Undocumented |
Method | has |
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 |
Undocumented |
Method | to |
Return True if the model associated with this admin should be allowed to be referenced by the specified field. |
Class Variable | autocomplete |
Undocumented |
Class Variable | exclude |
Undocumented |
Class Variable | fields |
Undocumented |
Class Variable | fieldsets |
Undocumented |
Class Variable | filter |
Undocumented |
Class Variable | filter |
Undocumented |
Class Variable | ordering |
Undocumented |
Class Variable | prepopulated |
Undocumented |
Class Variable | radio |
Undocumented |
Class Variable | raw |
Undocumented |
Class Variable | readonly |
Undocumented |
Class Variable | show |
Undocumented |
Class Variable | sortable |
Undocumented |
Class Variable | view |
Undocumented |
Instance Variable | formfield |
Undocumented |
def action_checkbox(self, obj): (source) ¶
A list_display column containing a checkbox widget.
def changeform_view(self, request, object_id=None, form_url='', extra_context=None): (source) ¶
Undocumented
Return a given action from a parameter, which can either be a callable, or the name of a method on the ModelAdmin. Return is a tuple of (callable, name, description).
Return a dictionary mapping the names of all actions for this ModelAdmin to a tuple of (callable, name, description) for each action.
django.contrib.auth.admin.UserAdmin
Return a Form class for use in the admin add view. This is used by add_view and change_view.
Return a sequence containing the fields to be displayed as links on the changelist. The list_display parameter is the list of fields returned by get_list_display().
Return a sequence containing the fields to be displayed as filters in the right sidebar of the changelist page.
Return a dict of all perms for this model. This dict has the keys ``add``, ``change``, ``delete``, and ``view`` mapping to the True/False for each of those actions.
Return an instance matching the field and value provided, the primary key is used if no field is provided. Return ``None`` if no match is found or the object_id fails validation.
Undocumented
Return a tuple containing a queryset to implement the search and a boolean indicating if the results may contain duplicates.
Log that an object has been successfully added. The default implementation creates an admin LogEntry object.
Log that an object has been successfully changed. The default implementation creates an admin LogEntry object.
Log that an object will be deleted. Note that this method must be called before the deletion. The default implementation creates an admin LogEntry object.
Send a message to the user. The default implementation posts a message using the django.contrib.messages backend. Exposes almost the same API as messages.add_message(), but accepts the positional arguments in a different order to maintain backwards compatibility. For convenience, it accepts the `level` argument as a string rather than the usual level number.
Undocumented
Handle an admin action. This is called if a request is POSTed to the changelist; it returns an HttpResponse if the action was handled, and None otherwise.
django.contrib.auth.admin.UserAdmin
Determine the HttpResponse for the add_view stage.
Figure out where to redirect after the 'Save' button has been pressed when editing an existing object.
Given a ModelForm return an unsaved instance. ``change`` is True if the object is being changed, and False if it's being added.
Given the ``HttpRequest``, the parent ``ModelForm`` instance, the list of inline formsets and a boolean value based on whether the parent is being added or changed, save the related objects to the database. Note that at this point save_form() and save_model() have already been called.
django.contrib.auth.admin.UserAdmin
, django.contrib.flatpages.admin.FlatPageAdmin
, django.contrib.redirects.admin.RedirectAdmin
Undocumented