summaryrefslogtreecommitdiff
path: root/main/models.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-04-07 16:52:52 -0500
committerDan McGee <dan@archlinux.org>2011-04-07 17:03:13 -0500
commit77842a6c76095277b024505708bf528d455b9c89 (patch)
tree686158efd744d0b35722df92cf91fa55a647e3e8 /main/models.py
parentd7665959652171b93db5e084c6738e8e1773e7f0 (diff)
Consolidate caching black magic
Get the stuff used to retrieve and refresh the latest date values all in the same place, and make it a bit more beautiful by refactoring it all into a common set of methods. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'main/models.py')
-rw-r--r--main/models.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/main/models.py b/main/models.py
index 8d34731f..38120134 100644
--- a/main/models.py
+++ b/main/models.py
@@ -128,8 +128,7 @@ class Package(models.Model):
class Meta:
db_table = 'packages'
ordering = ('pkgname',)
- #get_latest_by = 'last_update'
- #ordering = ('-last_update',)
+ get_latest_by = 'last_update'
def __unicode__(self):
return self.pkgname
@@ -390,10 +389,10 @@ def set_todolist_fields(sender, **kwargs):
todolist.date_added = datetime.utcnow()
# connect signals needed to keep cache in line with reality
-from main.utils import refresh_package_latest
+from main.utils import refresh_latest
from django.db.models.signals import pre_save, post_save
-post_save.connect(refresh_package_latest, sender=Package,
+post_save.connect(refresh_latest, sender=Package,
dispatch_uid="main.models")
pre_save.connect(set_todolist_fields, sender=Todolist,
dispatch_uid="main.models")