please elaborate the login_required part.did’nt get it .
and please tell all the working using decorator what we have done and how it is working.
Decorators in python
and how arguments are working in login_required.
Login_required takes in another function as parameter which we want to access only when the user gets authenticated .Hence we wrap it in such a way that it will require authentication . Wrapper function takes in 2 positional arguments- username and password . The function which we passed in login_required will only be executed if login is successful.
Def add(a,b):
Print(a+b)
add=login_required(add)
It is similar as writing -
@login_required
Def add(a,b):
Print(a+b)
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.