Re: get all current active connected users

2015-12-10 Thread Jani Tiainen

Hi,

That last login field only applies when user really logs in. (IOW you 
call login() function from django.contrib.auth). After that user is 
persisted to session so there is no need to authenticate per request.


Now if you have longer sessions than 24 hours user will stay logged in 
(I think default session TTL is 2 week after last modification). So that 
would still give troubles that users may have been active in last few 
seconds but not logged in for a few days.


On 09.12.2015 15:37, Jon Ribbens wrote:

On Wednesday, 9 December 2015 12:55:22 UTC, Jani Tiainen wrote:

This is really problematic domain since as you know, Django works
on HTTP request-response cycle. After cycle is finished there is
absolutely no way to know "who is logged on".

So first you have to determine factors that make up "currently
active user". Then you have to track that information somehow and
after that it's possible to gather a list of active/inactive users.


Users have a last_login field so you could easily say "users who have 
logged in in the last 24 hours" or whatever.

--
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/7c5f0620-c094-4667-b474-82a23f432fa1%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--

Jani Tiainen

--
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/566944D0.9020204%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: get all current active connected users

2015-12-09 Thread Jon Ribbens
On Wednesday, 9 December 2015 12:55:22 UTC, Jani Tiainen wrote:
>
> This is really problematic domain since as you know, Django works on HTTP 
> request-response cycle. After cycle is finished there is absolutely no way 
> to know "who is logged on".
>
> So first you have to determine factors that make up "currently active 
> user". Then you have to track that information somehow and after that it's 
> possible to gather a list of active/inactive users.
>

Users have a last_login field so you could easily say "users who have 
logged in in the last 24 hours" or whatever. 

-- 
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/7c5f0620-c094-4667-b474-82a23f432fa1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: get all current active connected users

2015-12-09 Thread Jani Tiainen

Hi,

This is really problematic domain since as you know, Django works on 
HTTP request-response cycle. After cycle is finished there is absolutely 
no way to know "who is logged on".


So first you have to determine factors that make up "currently active 
user". Then you have to track that information somehow and after that 
it's possible to gather a list of active/inactive users.


On 09.12.2015 14:43, Fabio C. Barrionuevo da Luz wrote:

hello,
Django provide any API for get all users who are currently connected?

I need to run some scheduled tasks for users who are not connected and 
did not understand how I can get the users with active login via Session





--
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/5668248D.2070501%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


get all current active connected users

2015-12-09 Thread Fabio C. Barrionuevo da Luz
hello,
Django provide any API for get all users who are currently connected?

I need to run some scheduled tasks for users who are not connected and did
not understand how I can get the users with active login via Session

-- 
Fábio C. Barrionuevo da Luz
Palmas - Tocantins - Brasil - América do Sul

http://pythonclub.com.br/

Blog colaborativo sobre Python e tecnologias Relacionadas, mantido
totalmente no https://github.com/pythonclub/pythonclub.github.io .

Todos são livres para publicar. É só fazer fork, escrever sua postagem e
mandar o pull-request. Leia mais sobre como publicar em README.md e
contributing.md.
Regra básica de postagem:
"Você" acha interessante? É útil para "você"? Pode ser utilizado com Python
ou é útil para quem usa Python? Está esperando o que? Publica logo, que
estou louco para ler...

-- 
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/CAPVjvMbRXkFEi95jL0is%3DNePz%3DSiAaHusSK1oJRei%3D-U%2B_jfGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.