summaryrefslogtreecommitdiff
path: root/app/gtd/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/gtd/models.py')
-rw-r--r--app/gtd/models.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/app/gtd/models.py b/app/gtd/models.py
index d309ac0..5a371d9 100644
--- a/app/gtd/models.py
+++ b/app/gtd/models.py
@@ -38,13 +38,11 @@ class GTDOutcome(models.Model):
class GTDProject(models.Model):
- WIRED = 0
LBH = 1
LXF = 2
PERSONAL = 3
BUS = 4
PROJECT_TYPE = (
- (WIRED, 'wired'),
(LBH, 'lbh'),
(LXF, 'lxf'),
(PERSONAL, 'personal'),
@@ -118,7 +116,7 @@ class GTDNote(models.Model):
(OPEN, 'Open'),
(COMPLETED, 'Completed'),
]
- status = models.SmallIntegerField(choices=STATUS, default=OPEN)
+ status = models.SmallIntegerField(choices=STATUS, default=NONE)
class Meta:
ordering = ('-date_created',)
@@ -150,7 +148,7 @@ class PostStatus(models.IntegerChoices):
ASSIGNED = 0, ('Assigned')
TURNEDIN = 1, ('turned in')
PUBLISHED = 2, ('published')
-
+ NEW = 3, ('NEW')
class WiredPost(models.Model):
# an entry in a feed
@@ -179,11 +177,16 @@ class WiredPost(models.Model):
td = datetime.date.today() - self.date_last_pub
return int(td.days)
- # def get_needs_update(self):
- # if self.time_since_update() > self.update_frequency:
- # return True
- # else:
- # return False
+ def set_needs_update(self):
+ if self.date_last_pub:
+ td = datetime.date.today() - self.date_last_pub
+ if self.post_status == 0 or 2 and td.days > self.update_frequency:
+ self.needs_update = True
+ self.save()
+ else:
+ self.needs_update = False
+ self.save()
+ return ''
def days_overdue(self):
if self.needs_update: