summaryrefslogtreecommitdiff
path: root/news/models.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-10-13 18:11:28 -0500
committerDan McGee <dan@archlinux.org>2010-10-13 18:11:28 -0500
commit97d1e4164bf5526c3b63570d27c8377b4dfcac46 (patch)
tree49b42c12f2ffc7256e1e24abe87100e03648bde5 /news/models.py
parent0c65360e6ccf812ae319b6a70e25804a224cca99 (diff)
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 <dan@archlinux.org>
Diffstat (limited to 'news/models.py')
-rw-r--r--news/models.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/news/models.py b/news/models.py
index 6c8a7039..e2486c96 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: