class AdminSite:
Method | add_action |
Register an action to be available globally. |
Method | disable_action |
Disable a globally-registered action. Raise KeyError for invalid names. |
Method | each_context |
Return a dictionary of variables to put in the template context for every page in the admin site. |
Method | has_permission |
Return True if the given HttpRequest has permission to view at least one page in the admin site. |
Method | register |
Register the given model(s) with the given admin class. |
Method | unregister |
Unregister the given model(s). |
Class Variable | app_index_template |
Undocumented |
Class Variable | empty_value_display |
Undocumented |
Class Variable | enable_nav_sidebar |
Undocumented |
Class Variable | final_catch_all_view |
Undocumented |
Class Variable | index_template |
Undocumented |
Class Variable | index_title |
Undocumented |
Class Variable | login_form |
Undocumented |
Class Variable | login_template |
Undocumented |
Class Variable | logout_template |
Undocumented |
Class Variable | password_change_done_template |
Undocumented |
Class Variable | password_change_template |
Undocumented |
Class Variable | site_header |
Undocumented |
Class Variable | site_title |
Undocumented |
Class Variable | site_url |
Undocumented |
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | _build_app_dict |
Build the app dictionary. The optional label parameter filters models of a specific app. |
Method | admin_view |
Decorator to create an admin view attached to this AdminSite. This wraps the view and provides permission checking by calling self.has_permission. |
Method | app_index |
Undocumented |
Method | autocomplete_view |
Undocumented |
Method | catch_all_view |
Undocumented |
Method | check |
Run the system checks on all ModelAdmins, except if they aren't customized at all. |
Method | get_action |
Explicitly get a registered global action whether it's enabled or not. Raise KeyError for invalid names. |
Method | get_app_list |
Return a sorted list of all the installed apps that have been registered in this site. |
Method | get_urls |
Undocumented |
Method | i18n_javascript |
Display the i18n JavaScript that the Django admin requires. |
Method | index |
Display the main admin index page, which lists all of the installed apps that have been registered in this site. |
Method | is_registered |
Check if a model class is registered with this AdminSite . |
Method | login |
Display the login form for the given HttpRequest. |
Method | logout |
Log out the user for the given HttpRequest. |
Method | password_change |
Handle the "change password" task -- both form display and validation. |
Method | password_change_done |
Display the "success" page after a password change. |
Instance Variable | _actions |
Undocumented |
Instance Variable | _global_actions |
Undocumented |
Instance Variable | _registry |
Undocumented |
Instance Variable | name |
Undocumented |
Property | actions |
Get all the enabled actions as an iterable of (name, func). |
Property | urls |
Undocumented |
Return a dictionary of variables to put in the template context for every page in the admin site.
For sites running on a subpath, use the SCRIPT_NAME value if site_url hasn't been customized.
Register the given model(s) with the given admin class.
The model(s) should be Model classes, not instances.
If an admin class isn't given, use ModelAdmin (the default admin options). If keyword arguments are given -- e.g., list_display -- apply them as options to the admin class.
If a model is already registered, raise AlreadyRegistered.
If a model is abstract, raise ImproperlyConfigured.
Unregister the given model(s).
If a model isn't already registered, raise NotRegistered.
label
parameter filters models
of a specific app.Decorator to create an admin view attached to this AdminSite. This wraps the view and provides permission checking by calling self.has_permission.
You'll want to use this from within AdminSite.get_urls():
class MyAdminSite(AdminSite):
- def get_urls(self):
from django.urls import path
urls = super().get_urls() urls += [
path('my_view/', self.admin_view(some_view))] return urls
By default, admin_views are marked non-cacheable using the never_cache decorator. If the view can be safely cached, set cacheable=True.
Display the i18n JavaScript that the Django admin requires.
extra_context
is unused but present for consistency with the other
admin views.
Log out the user for the given HttpRequest.
This should not assume the user is already logged in.