Friday, May 31, 2013

Re: Multiple Users Logged into a page at the same time

You could also use middleware instead of the view code to do the same thing. That way you wouldn't have to put that code in every view

On Friday, May 31, 2013 10:06:00 AM UTC-5, C. Kirby wrote:
Just going of the top of my head here:
Create a model like:

class OnPage(Model):
     user = foreignkey(User)
     page = TextField()

In each of your  your views do something like:

     op, created OnPage.objects.get_or_create(user = request.user) = thispage (The view name, the url, you can decide how to grab this)

You would also want an ajax call that triggers when the browser window is closed, running a view that does:
         OnPage.objects.get(user = request.user).delete()

On Friday, May 31, 2013 8:40:33 AM UTC-5, Alan wrote:

For a site that I am building, I want multiple users to be able to log in to a page at the same time. Something with the experience being very similar to what we have in Google Docs where I can see the users who are currently logged into and are active on the page. 

I'd want to be able to display all the active users on a page.

How do I go about building this in my Django-based website?

Help and suggestions would be appreciated. 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
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment