From 6da51a8cae0440eecc2d598c10df00f8bb0e31b2 Mon Sep 17 00:00:00 2001 From: Dusty Phillips Date: Fri, 10 Oct 2008 18:26:43 -0400 Subject: fix another inefficient query --- main/models.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'main') diff --git a/main/models.py b/main/models.py index 9f382cb0..663ea11e 100644 --- a/main/models.py +++ b/main/models.py @@ -41,15 +41,9 @@ class Meta: ####################### class TodolistManager(models.Manager): def get_incomplete(self): - results = [] - for l in self.all().order_by('-date_added'): - if TodolistPkg.objects.filter(list=l.id).filter( - complete=False).count() > 0: - results.append(l) - return results + return self.filter(todolistpkg__complete=False).distinct() class PackageManager(models.Manager): - def flagged(self): return self.get_query_set().filter(needupdate=True) @@ -271,19 +265,5 @@ class Meta: db_table = 'todolist_pkgs' unique_together = (('list','pkg'),) -class Wikipage(models.Model): - """Wiki page storage""" - title = models.CharField(max_length=255) - content = models.TextField() - last_author = models.ForeignKey(User, related_name='wikipage_last_author') - class Meta: - db_table = 'wikipages' - - def editurl(self): - return "/wiki/edit/" + self.title + "/" - - def __str__(self): - return self.title - # vim: set ts=4 sw=4 et: -- cgit v1.2.3-54-g00ecf