Django - How does the @login_required decorator work in the views of another app?

3

I have a project in Django and only an application where I make registrations, searches, login to the system, etc. I was reading an article on the creation of projects and I saw that because 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 this: I'm using the @login_required decorator in my views so the user only has access to the application's features if logged in. If I separate this application into several, (one to log in to the system, another to make the registrations) can I continue to use the decorator normally in the views of the other apps?

Note: Django 1.6.2 and python 2.7

    
asked by anonymous 26.05.2014 / 18:22

1 answer

2

You can use yes!

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

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

    
26.05.2014 / 18:58