admin.ModelAdmin.list_max_show_all

ModelAdmin.list_max_show_all Set list_max_show_all to control how many items can appear on a “Show all” admin change list page. The admin will display a “Show all” link on the change list only if the total result count is less than or equal to this setting. By default, this is set to 200.

admin.ModelAdmin.list_filter

ModelAdmin.list_filter Set list_filter to activate filters in the right sidebar of the change list page of the admin, as illustrated in the following screenshot: list_filter should be a list or tuple of elements, where each element should be of one of the following types: a field name, where the specified field should be either a BooleanField, CharField, DateField, DateTimeField, IntegerField, ForeignKey or ManyToManyField, for example: class PersonAdmin(admin.ModelAdmin): list_filter

admin.ModelAdmin.list_editable

ModelAdmin.list_editable Set list_editable to a list of field names on the model which will allow editing on the change list page. That is, fields listed in list_editable will be displayed as form widgets on the change list page, allowing users to edit and save multiple rows at once. Note list_editable interacts with a couple of other options in particular ways; you should note the following rules: Any field in list_editable must also be in list_display. You can’t edit a field that’s not di

admin.ModelAdmin.list_display_links

ModelAdmin.list_display_links Use list_display_links to control if and which fields in list_display should be linked to the “change” page for an object. By default, the change list page will link the first column – the first field specified in list_display – to the change page for each item. But list_display_links lets you change this: Set it to None to get no links at all. Set it to a list or tuple of fields (in the same format as list_display) whose columns you want converted to links. Y

admin.ModelAdmin.list_display

ModelAdmin.list_display Set list_display to control which fields are displayed on the change list page of the admin. Example: list_display = ('first_name', 'last_name') If you don’t set list_display, the admin site will display a single column that displays the __str__() (__unicode__() on Python 2) representation of each object. You have four possible values that can be used in list_display: A field of the model. For example: class PersonAdmin(admin.ModelAdmin): list_display = ('first_

admin.ModelAdmin.inlines

ModelAdmin.inlines See InlineModelAdmin objects below as well as ModelAdmin.get_formsets_with_inlines().

admin.ModelAdmin.history_view()

ModelAdmin.history_view(request, object_id, extra_context=None) [source] Django view for the page that shows the modification history for a given model instance. Unlike the hook-type ModelAdmin methods detailed in the previous section, these five methods are in reality designed to be invoked as Django views from the admin application URL dispatching handler to render the pages that deal with model instances CRUD operations. As a result, completely overriding these methods will significantly

admin.ModelAdmin.has_module_permission()

ModelAdmin.has_module_permission(request) Should return True if displaying the module on the admin index page and accessing the module’s index page is permitted, False otherwise. Uses User.has_module_perms() by default. Overriding it does not restrict access to the add, change or delete views, has_add_permission(), has_change_permission(), and has_delete_permission() should be used for that.

admin.ModelAdmin.has_delete_permission()

ModelAdmin.has_delete_permission(request, obj=None) Should return True if deleting obj is permitted, False otherwise. If obj is None, should return True or False to indicate whether deleting objects of this type is permitted in general (e.g., False will be interpreted as meaning that the current user is not permitted to delete any object of this type).

admin.ModelAdmin.has_change_permission()

ModelAdmin.has_change_permission(request, obj=None) Should return True if editing obj is permitted, False otherwise. If obj is None, should return True or False to indicate whether editing of objects of this type is permitted in general (e.g., False will be interpreted as meaning that the current user is not permitted to edit any object of this type).