summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-12-27 23:32:05 -0600
committerDan McGee <dan@archlinux.org>2012-12-28 09:19:19 -0600
commitf07a5862c9ed40646677344eaf920dbd05a1a137 (patch)
treeb5e0162b0cfe543fb0c848aade770e95a051554f
parentf167d6e6e8ba2ca5e29f6a1a82b0e273ffec13ab (diff)
Add packages method to new Todolist model
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--todolists/models.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/todolists/models.py b/todolists/models.py
index 7af7faf9..c38c564e 100644
--- a/todolists/models.py
+++ b/todolists/models.py
@@ -41,6 +41,12 @@ class Todolist(models.Model):
domain = Site.objects.get_current().domain
return '%s://%s%s' % (proto, domain, self.get_absolute_url())
+ def packages(self):
+ if not hasattr(self, '_packages'):
+ self._packages = self.todolistpackage_set.select_related(
+ 'pkg', 'repo', 'arch').order_by('pkgname', 'arch')
+ return self._packages
+
class TodolistPackage(models.Model):
INCOMPLETE = 0