summaryrefslogtreecommitdiff
path: root/todolists/models.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-12-31 11:31:35 -0600
committerDan McGee <dan@archlinux.org>2012-12-31 11:31:35 -0600
commit7952fe0ede3a5a68a64f05eccb180194394652f3 (patch)
tree336bd947ab85efa8dbe5758f63393d3533f8f5e6 /todolists/models.py
parent827b426b4dce6641e77dac975dae180ce6e20b0a (diff)
Mark todolist packages as removed rather than deleting them
This makes it easier to see the progression of a todolist and its contents easier since we are no longer losing the data. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'todolists/models.py')
-rw-r--r--todolists/models.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/todolists/models.py b/todolists/models.py
index 156b041d..040f8a29 100644
--- a/todolists/models.py
+++ b/todolists/models.py
@@ -10,8 +10,9 @@ from main.utils import set_created_field
class TodolistManager(models.Manager):
def incomplete(self):
- not_done = (Q(todolistpackage__status=TodolistPackage.INCOMPLETE) |
- Q(todolistpackage__status=TodolistPackage.IN_PROGRESS))
+ not_done = ((Q(todolistpackage__status=TodolistPackage.INCOMPLETE) |
+ Q(todolistpackage__status=TodolistPackage.IN_PROGRESS)) &
+ Q(todolistpackage__removed__isnull=True))
return self.order_by().filter(not_done).distinct()
@@ -44,7 +45,8 @@ class Todolist(models.Model):
def packages(self):
if not hasattr(self, '_packages'):
- self._packages = self.todolistpackage_set.select_related(
+ self._packages = self.todolistpackage_set.filter(
+ removed__isnull=True).select_related(
'pkg', 'repo', 'arch').order_by('pkgname', 'arch')
return self._packages