mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #6327 -- Added has_module_permission method to BaseModelAdmin
Thanks chrj for the suggestion.
This commit is contained in:
parent
bf743a4d57
commit
504c89e800
9 changed files with 201 additions and 7 deletions
|
@ -1631,6 +1631,19 @@ templates used by the :class:`ModelAdmin` views:
|
|||
be interpreted as meaning that the current user is not permitted to delete
|
||||
any object of this type).
|
||||
|
||||
.. method:: ModelAdmin.has_module_permission(request)
|
||||
|
||||
.. versionadded:: 1.8
|
||||
|
||||
Should return ``True`` if displaying the module on the admin index page and
|
||||
accessing the module's index page is permitted, ``False`` otherwise.
|
||||
Uses :meth:`User.has_module_perms()
|
||||
<django.contrib.auth.models.User.has_module_perms>` by default. Overriding
|
||||
it does not restrict access to the add, change or delete views,
|
||||
:meth:`~ModelAdmin.has_add_permission`,
|
||||
:meth:`~ModelAdmin.has_change_permission`, and
|
||||
:meth:`~ModelAdmin.has_delete_permission` should be used for that.
|
||||
|
||||
.. method:: ModelAdmin.get_queryset(request)
|
||||
|
||||
The ``get_queryset`` method on a ``ModelAdmin`` returns a
|
||||
|
@ -1909,6 +1922,7 @@ adds some of its own (the shared features are actually defined in the
|
|||
- :meth:`~ModelAdmin.has_add_permission`
|
||||
- :meth:`~ModelAdmin.has_change_permission`
|
||||
- :meth:`~ModelAdmin.has_delete_permission`
|
||||
- :meth:`~ModelAdmin.has_module_permission`
|
||||
|
||||
The ``InlineModelAdmin`` class adds:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue