Search code examples
pythonsqldjangodjango-modelsdjango-signals

Django 1.3, how to signal when a post has ended like on ebay?


I'm totally confused and have no idea how to do this, so please forgive me if my description/information is bad.

So I want say to do a notification via django-notification or simply send an e-mail to one of my user when a post of his had ended like on ebay. In my database I have a model which stores the datetime of when the post is going to end, but I'm not sure how to effectively check or store a signal or something which would alert the system to alert the user when the current time is > than the end datetime.

thanks!

Since I want to send an email/notification the second a post ends, I don't think I can use a scheduler to check if any post had ended, I believe this would be too inefficient, because I would have to check like every second, but like I said above, I'm not sure about anything...


Solution

  • You could use django-celery -- connect a post_save handler that checks if created is True, and if so schedules a Task that'll notify the user at the correct time (using the eta keyword arg).