From 97d1e4164bf5526c3b63570d27c8377b4dfcac46 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 13 Oct 2010 18:11:28 -0500 Subject: Connect post_save signals where they will always be triggered We need to do this in the models.py files, otherwise the post_save signal might not be connected right away on launch of the application. Move them over there, add a dispatch_uid so it only gets hooked up once, and do some other function moving around so we don't have circular imports. Signed-off-by: Dan McGee --- news/models.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'news') diff --git a/news/models.py b/news/models.py index 6c8a703..e2486c9 100644 --- a/news/models.py +++ b/news/models.py @@ -23,4 +23,10 @@ class News(models.Model): get_latest_by = 'postdate' ordering = ['-postdate'] +# connect signals needed to keep cache in line with reality +from main.utils import refresh_news_latest +from django.db.models.signals import post_save +post_save.connect(refresh_news_latest, sender=News, + dispatch_uid="news.models") + # vim: set ts=4 sw=4 et: -- cgit v1.2.3-24-g4f1b