On Tuesday 21 February 2017 13:11:19 John, Steffen wrote:

> Using celery, is it possible to prevent the user from doing other
> things in the admin tool until the celery task is done?

Sorta kinda.
But the django admin can facilitate part of it. Look into the 
ModelAdmin.has_FOO_permission() methods. These get passed the request. So you 
could implement something like:

- set has_job_running on User profile model
- for possibly dangerous actions, return false for the has_FOO_permission() 
method 
if request.user.profile.has_job_running is True.
- on job end, reset the user's has_job_running flag.

You can refine this to a tee, with different completion stages for the job 
opening up 
otherwise denied actions, etc etc.

The timeout however, is something with your webserver / wsgi implementation and 
you should look there. For example, nginx has several timeouts for handling a 
WSGI 
request that come into play. Increasing those, also means you tie up resources 
and 
are more succeptable to denial of service, so if celery is an option, take it.

-- 
Melvyn Sopacua

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4611612.S1g8pcmQCG%40devstation.
For more options, visit https://groups.google.com/d/optout.

Reply via email to