Django - How does Developer @login_required work in views from another app?

Asked

Viewed 146 times

3

I have a project in Django and only an application where I do registration, searches, login to the system, etc. I was reading an article about the creation of projects and saw that for the sake of organization it is normal to have several applications in the same project, for example: an app for the registrations, another app to authenticate and log the user into the system, etc.

My question is the following: I am using the @login_required developer in my views so that the user only has access to the application’s features if he is logged in. If I separate this application into several, (one to log in to the system, another to register) I can continue using the Developer normally in the views of other apps ?

Note: Django 1.6.2 and python 2.7

1 answer

2


Can use yes!

Django has a middleware that is responsible for user login "at project level", not being tied to any app that you created.

Assuming you already have an app using @login_required and that is working normally, just add the developer in the other app in the same way.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.