[Answered ]-Unable to access request headers in decorator – django 4.0.4

1👍

Delete ‘def check_access():’ and Change decorate function to check_access.
And move ‘self’ argument.

in View Function

class DetailsView(View):
    @check_access
    def get(request): # Delete Self     
        ....

in decorator

def check_access(view_function):
    def wrap(self, request, *args, **kwargs): # add self
        ...
    return wrap

referenced site : Decorator

Leave a comment