Corrected PermissionsMixin docs regarding User.is_active and is_superuser.

This commit is contained in:
Tobias Bengfort 2018-11-10 11:11:00 +01:00 committed by Tim Graham
parent d48662122c
commit d33864ed13
1 changed files with 9 additions and 6 deletions

View File

@ -919,8 +919,9 @@ methods and attributes:
Returns ``True`` if the user has the specified permission, where Returns ``True`` if the user has the specified permission, where
``perm`` is in the format ``"<app label>.<permission codename>"`` (see ``perm`` is in the format ``"<app label>.<permission codename>"`` (see
:ref:`permissions <topic-authorization>`). If the user is inactive, this method will :ref:`permissions <topic-authorization>`). If :attr:`.User.is_active`
always return ``False``. and :attr:`~.User.is_superuser` are both ``True``, this method always
returns ``True``.
If ``obj`` is passed in, this method won't check for a permission for If ``obj`` is passed in, this method won't check for a permission for
the model, but for this specific object. the model, but for this specific object.
@ -929,8 +930,9 @@ methods and attributes:
Returns ``True`` if the user has each of the specified permissions, Returns ``True`` if the user has each of the specified permissions,
where each perm is in the format where each perm is in the format
``"<app label>.<permission codename>"``. If the user is inactive, ``"<app label>.<permission codename>"``. If :attr:`.User.is_active` and
this method will always return ``False``. :attr:`~.User.is_superuser` are both ``True``, this method always
returns ``True``.
If ``obj`` is passed in, this method won't check for permissions for If ``obj`` is passed in, this method won't check for permissions for
the model, but for the specific object. the model, but for the specific object.
@ -938,8 +940,9 @@ methods and attributes:
.. method:: models.PermissionsMixin.has_module_perms(package_name) .. method:: models.PermissionsMixin.has_module_perms(package_name)
Returns ``True`` if the user has any permissions in the given package Returns ``True`` if the user has any permissions in the given package
(the Django app label). If the user is inactive, this method will (the Django app label). If :attr:`.User.is_active` and
always return ``False``. :attr:`~.User.is_superuser` are both ``True``, this method always
returns ``True``.
.. admonition:: ``PermissionsMixin`` and ``ModelBackend`` .. admonition:: ``PermissionsMixin`` and ``ModelBackend``