#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
-------------------------------------+-------------------------------------
Changes (by Nick Pope):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 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 the using the mixin is
 straightforward.)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29220#comment:3>
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.ef5b044ebcd71591ded37cd0ee64d1fa%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to