Sunday, May 28, 2017

Session Variables

Dear Experts, I am new to Django and need your help.

I want a set of variables populated into session variables. These will be fixed values for the user such as which company he belongs to, his email id, his role etc. 

These values will be read from the database by the login form. These values need to stay in these variables as long as the user is logged into the application.

I will be using these variables to decide what data the user can see.

Question I have is "Will these values be different for each user who is logged in or are these global to the application and all the users will see these same values?

I am using the below code to get the values from the table called "users" where userroles, companyid are fields in the table

         tFetchData = users.objects.get(emailid = lEmailId)

        request.session['sPassword'] = tFetchData.userroles
        request.session['sCompanyId'] = tFetchData.companyid

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1b6fdc83-26dd-4d7f-879c-95aacc282f59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment