Changes between Initial Version and Version 1 of Ticket #29220
- Timestamp:
- Mar 14, 2018, 3:57:55 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #29220
- Property Type Uncategorized → New 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 request1 I 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` 2 2 3 3 example: 4 `def index(self, request):` 4 `@user_passes_test(role_client_check)` 5 `def index(self, request):` 5 6 6 7 Fatal error: Class don't have attribute user. 7 8 8 Th is Change work for Django 1.119 but i see that file dont change a lot in Django 2.X9 The next new change work for Django 1.11 10 but i see that Django 2.X file, doesn't change a lot 10 11 11 12 Now 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):` 14 15 15 arg_positioncan be specific when the first argument isn't "request"16 arg_positionis a integer with the position of request on view function16 `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 17 18 18 19 I created my own user_passes_test function to solve this feature.