#24914: Include basic permission mixins into Django
------------------------------+------------------------------------
Reporter: raphaelm | Owner: MarkusH
Type: New feature | Status: assigned
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Comment (by MarkusH):
Thanks for mentioning that, Rundll. The current implementation does not
support stacking them (braces' `LoginRequired` and `PermissionRequired`
mixins do, though). However, neither our `UserPassesTestMixin` nor braces'
allows stacking inherited mixins, either.
That makes me wonder how one is supposed to combine different permission
checks that are used separately and together:
{{{#!python
class CheckOneMixin(UserPassesTestMixin):
def test_func(self, user):
return something_is_true_or_false
class CheckTwoMixin(UserPassesTestMixin):
def test_func(self, user):
return something_else_is_true_or_false
class MyView1(CheckOneMixin, View):
pass
class MyView2(CheckTwoMixin, View):
pass
class MyView3(CheckOneMixin, CheckTwoMixin, View):
pass
}}}
Effectively, `MyView3` will never bother about the value of
`something_else_is_true_or_false` as that function is never called.
--
Ticket URL: <https://code.djangoproject.com/ticket/24914#comment:13>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.63dd14dbf28e9aa744faa8e1f8cf1c3e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.