diff options
| author | Akis Kesoglou <akiskesoglou@gmail.com> | 2015-07-25 11:36:28 +0300 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-07-27 10:23:56 -0400 |
| commit | 29465d438e00660221e1e0ac5e2929a719c56113 (patch) | |
| tree | 2f0877383337030c48831512af0b21b24aafaa7e /docs | |
| parent | bc7923beffea3c51271935cad1371a67c5fcc71b (diff) | |
Fixed #25142 -- Added PermissionRequiredMixin.has_permission() to allow customization.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/auth/default.txt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt index 29447982f6..e388ec51ee 100644 --- a/docs/topics/auth/default.txt +++ b/docs/topics/auth/default.txt @@ -712,6 +712,21 @@ To apply permission checks to :doc:`class-based views :class:`~django.contrib.auth.mixins.AccessMixin` to customize the handling of unauthorized users. + You may also override these methods: + + .. method:: get_permission_required() + + Returns an iterable of permission names used by the mixin. Defaults to + the ``permission_required`` attribute, converted to a tuple if + necessary. + + .. method:: has_permission() + + Returns a boolean denoting whether the current user has permission to + execute the decorated view. By default, this returns the result of + calling :meth:`~django.contrib.auth.models.User.has_perms()` with the + list of permissions returned by :meth:`get_permission_required()`. + Redirecting unauthorized requests in class-based views ------------------------------------------------------ |
