summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2024-01-17 08:25:46 -0500
committerluxagraf <sng@luxagraf.net>2024-01-17 08:25:46 -0500
commitf75f5181c25b49c51bf108357b6d9cb563055063 (patch)
tree12f2e304bcc03b15ba4a86ad6ca6914eb6653621 /app
parent67aeb0ae68b52442e7b35c4904ca86d74bae76ff (diff)
gtd: fixed some view code and update main menu to make wired todo a
link
Diffstat (limited to 'app')
-rw-r--r--app/gtd/models.py18
-rw-r--r--app/gtd/views.py14
2 files changed, 18 insertions, 14 deletions
diff --git a/app/gtd/models.py b/app/gtd/models.py
index cf0d086..fd4a11a 100644
--- a/app/gtd/models.py
+++ b/app/gtd/models.py
@@ -87,6 +87,12 @@ class GTDProject(models.Model):
self.body_html = markdown_to_html(md)
super(GTDProject, self).save(*args, **kwargs)
+class NoteType(models.IntegerChoices):
+ ACTION = 0, ('Action')
+ REMINDER = 1, ('Reminder')
+ REFERENCE = 2, ('Reference')
+ SOMEDAY = 3, ('Someday')
+
class GTDNote(models.Model):
title = models.CharField(max_length=200)
@@ -95,17 +101,7 @@ class GTDNote(models.Model):
body_html = models.TextField(blank=True)
date_completed = models.DateField(null=True, blank=True)
date_created = models.DateTimeField(auto_now=True)
- ACTION = 0
- REMINDER = 1
- REFERENCE = 2
- SOMEDAY = 3
- NOTE_TYPE = [
- (ACTION, 'Action'),
- (REMINDER, 'Reminder'),
- (REFERENCE, 'Reference'),
- (SOMEDAY, 'Someday'),
- ]
- note_type = models.SmallIntegerField(choices=NOTE_TYPE, default=ACTION)
+ note_type = models.SmallIntegerField(choices=NoteType.choices, default=NoteType.ACTION)
reminder = models.BigIntegerField(help_text="In days", null=True, blank=True)
project = models.ForeignKey(GTDProject, on_delete=models.SET_NULL, null=True, blank=True)
NONE = 0
diff --git a/app/gtd/views.py b/app/gtd/views.py
index 96c6387..dbf7587 100644
--- a/app/gtd/views.py
+++ b/app/gtd/views.py
@@ -2,7 +2,15 @@ from django.views.generic import UpdateView, DetailView, ListView, CreateView, D
from django.urls import reverse, reverse_lazy
from django.db.models import Q
-from .models import GTDNote, GTDProject, GTDOutcome, WiredNote, WiredPost
+from .models import (
+ GTDNote,
+ GTDProject,
+ GTDOutcome,
+ WiredNote,
+ WiredPost,
+ NoteType
+)
+
from .forms import (
GTDNoteCreateForm,
GTDNoteEditForm,
@@ -80,8 +88,8 @@ class GTDNoteTODOView(ListView):
# need to get wired notes and gtd notes and blend them by
# date created maybe?
if project:
- return GTDNote.objects.filter(status=1,note_type__in=[1,2],project__title=project)
- return GTDNote.objects.filter(status=1,note_type__in=[1,2])
+ return GTDNote.objects.filter(status__in=[0, 1], note_type__in=[NoteType.REMINDER, NoteType.ACTION],project__title=project)
+ return GTDNote.objects.filter(status__in=[0, 1], note_type__in=[NoteType.REMINDER, NoteType.ACTION])
def get_context_data(self, **kwargs):
context = super(GTDNoteTODOView, self).get_context_data(**kwargs)