Get user logged in to Django globally

Asked

Viewed 1,776 times

1

All my models has relationship with the User, and for default all of mine query_set will be made based on the user logged in to the system. How would you get the user logged in to any area of the app, for example the model, because in it I will create my own objectManager to bring the query per user?

3 answers

2

2


It does not solve your problem if in the views you use the request.user when you’re making the wishes?

0

How to display the username logged in to a system/site using Django 1.7+.

Just put the line below in the template (html page) to display the full name:

{{ user.get_full_name }} To display the username:

{{ user.get_username }} For more information visit:

https://docs.djangoproject.com/en/1.7/topics/auth/

Browser other questions tagged

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