Tuesday, March 5, 2013

Re: I want to check for new orders in the background?

On Tuesday, March 5, 2013 1:38:14 PM UTC, frocco wrote:
I want to query the orders database every 5 minutes and alert admins that new orders have arrived.
Would I use signals for this?

Using a receiver attached to the post_save signal of your Order model would certainly be more efficient than polling the database. You could also generate the e-mail inside the save() method of your model. However you need to be careful as both may block your application.
 
Anyone have an example?

Everything you need is here: https://docs.djangoproject.com/en/dev/topics/signals/ 

--
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