#29220: Auth: change user_passes_test func, new arg arg_position add
-------------------------------------+-------------------------------------
Reporter: Oscar Lopez | Owner: nobody
Type: New feature | Status: closed
Component: contrib.auth | Version: 1.11
Severity: Normal | Resolution: invalid
Keywords: Auth, | Triage Stage:
user_passes_test, decorator | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Oscar Lopez):
Replying to [comment:3 Nick Pope]:
> It looks like you have misunderstood how this works.
>
> When using a class-based view (CBV) you need to use
[https://docs.djangoproject.com/en/stable/topics/auth/default/#django.contrib.auth.mixins.UserPassesTestMixin
UserPassesTestMixin] instead of the `@user_passes_test` decorator.
>
> (Alternatively, you can use `@method_decorator` to make this work - see
https://stackoverflow.com/q/8082670/ - but using the mixin is
straightforward.)
Oh y tried django.contrib.auth.mixins.UserPassesTestMixin but this work
only when using class-based views, im going to try the stackoverflow
method
--
Ticket URL: <https://code.djangoproject.com/ticket/29220#comment:5>
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/073.ac92367a8bfd6b79d6d20ade4e5c6e4e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.