You can't?

Not without logging out the previous user.

The session itself is used to contain a reference to the current user. You
can only have one session to a certain domain (for example www.example.com
and app.example.com are 2 different domains). The only way for the other
user to login is to create a new sesison (and invalidating the old one).

Regards,

Andréas

2016-02-11 12:47 GMT+01:00 Aakash Tewari <[email protected]>:

> Hello
>
>
> Here is new one I guess.
>
> We have 3 types of users say A, B, C. All have 3 different login pages on
> same domain. We have extended User model by OneToOne relationship like this
>
> class AModel(models.Model):
>     users = models.OneToOneField(User, on_delete=models.CASCADE)
>     is_A = models.NullBooleanField(default=False)
>
> class BModel(models.Model):
>     users = models.OneToOneField(User, on_delete=models.CASCADE)
>     is_B = models.NullBooleanField(default=False)
>
>
> class BModel(models.Model):
>     users = models.OneToOneField(User, on_delete=models.CASCADE)
>     is_B = models.NullBooleanField(default=False)
>
>
> Now During login we check like this :
>
> username=request.POST.get('username','')
> password=request.POST.get('pass','')
> user = authenticate(username=username, password=password)
> u = AModel.objects.get(users=user)
> if user is not None:
>    if user.is_active and u.isA:
>       login(request, user)
>       return HttpResponseRedirect("/home/")
>
> same way for B and C
>
>
>
> Now issue is when A login session is set and everything works fine, but when 
> user B logins, session for user A is removed.
>
> How can we allow 3 user 3 tabs 3 diff(login and home page)  on same browser
>
>
> Thanks
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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/5b9ed0bd-0e32-4239-8ebd-ab6275f82680%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/5b9ed0bd-0e32-4239-8ebd-ab6275f82680%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/CALXYUbnTWSDhSzfMe_fDQ18WMh7VXbs0gGYkkAhzE%2Bw3RzoXDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to