Changes between Initial Version and Version 1 of Ticket #29220


Ignore:
Timestamp:
Mar 14, 2018, 3:57:55 PM (6 years ago)
Author:
Oscar Lopez
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29220

    • Property Type UncategorizedNew feature
  • Ticket #29220 – Description

    initial v1  
    1 I had problems Add my decorations user_passes_test functions, because decorator _wrapped_view assume, the first arg is the requests parameter, when i call user_passes_test from a view into a class, that not work, it take the arg self look like a arg request
     1I had problems Add my decorations user_passes_test functions, because decorator _wrapped_view assume, the first arg is the `request` var parameter, when i call user_passes_test from a view into a class, that not work, it take the arg `self` look like a arg `request`
    22
    33example:
    4 `def index(self, request):`
     4`@user_passes_test(role_client_check)`
     5   `def index(self, request):`
    56
    67Fatal error: Class don't have attribute user.
    78
    8 This Change work for Django 1.11
    9 but i see that file dont change a lot in Django 2.X
     9The next new change work for Django 1.11
     10but i see that Django 2.X file, doesn't change a lot
    1011
    1112Now i can call the auth:
    12   @user_passes_test(role_client_check, arg_position=0)
    13       def index(self, request):
     13`@user_passes_test(role_client_check, arg_position=0)`
     14   `def index(self, request):`
    1415
    15 arg_position can be specific when the first argument isn't "request"
    16 arg_position is a integer with the position of request on view function
     16`arg_position` can be specific when the first argument isn't "request"
     17`arg_position` is a integer with the position of request on view function
    1718
    1819I created my own user_passes_test function to solve this feature.
Back to Top