Friday, May 31, 2013

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

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)
     op.page = 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:
     try:
         OnPage.objects.get(user = request.user).delete()
     else:
         pass

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

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. :)

Thanks,
Alan

--
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment