summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorDusty Phillips <buchuki@gmail.com>2008-10-10 18:26:43 -0400
committerDusty Phillips <buchuki@gmail.com>2008-10-10 18:26:43 -0400
commit6da51a8cae0440eecc2d598c10df00f8bb0e31b2 (patch)
treed791adab123884c914ca37606d491d2169310754 /main
parent5deece773c4083de6e2769c2ea7976412e40d206 (diff)
fix another inefficient query
Diffstat (limited to 'main')
-rw-r--r--main/models.py22
1 files changed, 1 insertions, 21 deletions
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 UserProfile(models.Model):
#######################
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 TodolistPkg(models.Model):
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: