Hi,
I've created my own user model for my project and it is like this

from django.db              import models
from webapp.models.group    import Group 
from webapp.models.userrole import UserRole

class GroupAdmin(models.Model): 
    user_name         = models.CharField(max_length = 200, blank=True, 
null=True)
    first_name        = models.CharField(max_length = 50, blank=True, 
null=True)
    last_name         = models.CharField(max_length = 50, blank=True, 
null=True)
    password          = models.CharField(max_length = 200, blank=True, 
null=True)
    group             = models.ForeignKey(Group)
    email             = models.EmailField()
    phone             = models.CharField(max_length = 15, blank=True, 
null=True)
    access_code       = models.CharField(max_length = 200)
    is_verified       = models.BooleanField(default = False)
    created_user_type = models.ForeignKey(UserRole)
    created_user_id   = models.IntegerField()
    last_login        = models.DateTimeField(null=True, blank=True)
    user_role         = models.IntegerField(default = 0)
 
    def __unicode__(self):
        return self.user_name

How do I keep and destroy the session of this user on login and logout. 
When logging in I need to store user_id, user_name and user_role in session.
When another user trying to login in the same browser on another tab, I 
also need to log out of the first user. All the views I have written should 
only be accessed by logged in users.
How can I ensure that?
Any help would be appreciated.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/13536b95-ec15-4b50-8a4f-cdab09d87c39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to