From f07a5862c9ed40646677344eaf920dbd05a1a137 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 27 Dec 2012 23:32:05 -0600 Subject: Add packages method to new Todolist model Signed-off-by: Dan McGee --- todolists/models.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'todolists') diff --git a/todolists/models.py b/todolists/models.py index 7af7faf..c38c564 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 -- cgit v1.2.3-24-g4f1b