summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-01-30 16:18:40 -0600
committerDan McGee <dan@archlinux.org>2010-01-30 16:18:40 -0600
commit5360d7d3d96828905dd92245faf1bec4cd6ffbc1 (patch)
tree19c9bb831f8878329401cacb5f6453db2354a914 /main
parent61e8a6b4c337900c5d32425f1ed81c3c5d19621b (diff)
Fix todolist bug with select_related()
Hey, what do you know? Using a relational DB in a non-relational way can come back to bite you. Go foreign keys! Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'main')
-rw-r--r--main/models.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/main/models.py b/main/models.py
index 71b9e181..7a3496a0 100644
--- a/main/models.py
+++ b/main/models.py
@@ -303,7 +303,10 @@ class Todolist(models.Model):
@property
def packages(self):
- return TodolistPkg.objects.select_related().filter(list=self).order_by('pkg')
+ # TODO: bug here, because we do foreign keys all wrong the join query fucks up when it
+ # can't find a foreign key that is missing values, e.g. maintainer == 0.
+ # Once this is fixed, we can remove the depth argument.
+ return TodolistPkg.objects.select_related(depth=1).filter(list=self).order_by('pkg')
@property
def package_names(self):