Answer the question
In order to leave comments, you need to log in
Django. is_authenticated is needed in every function?
Django project. The function that loads the main page on the site checks if the user is logged in: if request.user.is_authenticated(): ... , if not, sends it to the login page.
Other functions accept and return various data from the database, some return markup. Do any of these other functions need to check with is_authenticated, or a decorator, to prevent unlogged users from accessing the database?
Answer the question
In order to leave comments, you need to log in
if the data should not be available to unregistered users, then you need to add a decorator, but not for each function, but for the module in which these functions are located or close the entire route for an unlogged user.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question