class AdminSite: (source)
An AdminSite object encapsulates an instance of the Django admin application, ready to be hooked in to your URLconf. Models are registered with the AdminSite using the register() method, and the get_urls() method can then be used to access Django view functions that present a full admin interface for the collection of registered models.
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | add |
Register an action to be available globally. |
Method | admin |
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 |
Undocumented |
Method | autocomplete |
Undocumented |
Method | catch |
Undocumented |
Method | check |
Run the system checks on all ModelAdmins, except if they aren't customized at all. |
Method | disable |
Disable a globally-registered action. Raise KeyError for invalid names. |
Method | each |
Return a dictionary of variables to put in the template context for *every* page in the admin site. |
Method | get |
Explicitly get a registered global action whether it's enabled or not. Raise KeyError for invalid names. |
Method | get |
Return a sorted list of all the installed apps that have been registered in this site. |
Method | get |
Undocumented |
Method | has |
Return True if the given HttpRequest has permission to view *at least one* page in the admin site. |
Method | i18n |
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 |
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 |
Handle the "change password" task -- both form display and validation. |
Method | password |
Display the "success" page after a password change. |
Method | register |
Register the given model(s) with the given admin class. |
Method | unregister |
Unregister the given model(s). |
Class Variable | app |
Undocumented |
Class Variable | empty |
Undocumented |
Class Variable | enable |
Undocumented |
Class Variable | final |
Undocumented |
Class Variable | index |
Undocumented |
Class Variable | index |
Undocumented |
Class Variable | login |
Undocumented |
Class Variable | login |
Undocumented |
Class Variable | logout |
Undocumented |
Class Variable | password |
Undocumented |
Class Variable | password |
Undocumented |
Class Variable | site |
Undocumented |
Class Variable | site |
Undocumented |
Class Variable | site |
Undocumented |
Instance Variable | name |
Undocumented |
Property | actions |
Get all the enabled actions as an iterable of (name, func). |
Property | urls |
Undocumented |
Method | _build |
Build the app dictionary. The optional `label` parameter filters models of a specific app. |
Instance Variable | _actions |
Undocumented |
Instance Variable | _global |
Undocumented |
Instance Variable | _registry |
Undocumented |
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.
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.
Explicitly get a registered global action whether it's enabled or not. Raise KeyError for invalid names.
Display the i18n JavaScript that the Django admin requires. `extra_context` is unused but present for consistency with the other admin views.
Display the main admin index page, which lists all of the installed apps that have been registered in this site.
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.