2 years ago

#72776

test-img

E_K

Is there a difference in calling a decorator e.g @login_required() vs using just @login_required

I've seen code such as

@login_required()
def user_profile(request):
    # do stuff here

I've also seen some code written as

@login_required
def user_profile(request):
    # do stuff here

Note the missing () in the second example. On testing, both of them work the same. Is there any difference between the 2 approaches?

python

python-decorators

0 Answers

Your Answer

Accepted video resources