Class Signature
AdminTab extends Django’s ModelAdmin to provide a tabbed interface within the Django admin. It’s designed to be used with TabbedModelAdmin to organize model change views into multiple tabs.
Class Attributes
Optionally override the model for this admin tab. If not specified, inherits from the parent
TabbedModelAdmin.Optionally specify a custom display name for this admin tab. If not provided, the class name will be used.
The template used for rendering the change form within a tab.
The template used for rendering the change list within a tab.
Methods
get_tab_name()
str - The tab name from admin_tab_name if set, otherwise the class name.
Example:
get_tab_slug()
str - A slugified version of the tab name.
Example:
process_view()
TabbedModelAdmin when navigating to a tab.
Parameters:
request- The Django HttpRequest objectobject_id- The ID of the object being viewedextra_context(dict | None) - Optional additional context to pass to the template
HttpResponse - The response from change_view()
This method delegates to Django’s standard
change_view() method, allowing tabs to behave like regular ModelAdmin views.get_model_perms()
request- The Django HttpRequest object
dict - An empty dictionary
Tabs are accessed through their parent
TabbedModelAdmin and should not appear as standalone entries in the admin index.