diff options
Diffstat (limited to 'app/gtd')
-rw-r--r-- | app/gtd/models.py | 38 | ||||
-rw-r--r-- | app/gtd/templates/gtd/note_list.html | 5 | ||||
-rw-r--r-- | app/gtd/urls.py | 4 | ||||
-rw-r--r-- | app/gtd/views.py | 19 |
4 files changed, 28 insertions, 38 deletions
diff --git a/app/gtd/models.py b/app/gtd/models.py index 22af090..28649c6 100644 --- a/app/gtd/models.py +++ b/app/gtd/models.py @@ -43,11 +43,15 @@ class GTDOutcome(models.Model): class GTDProject(models.Model): + WIRED = 0 + LBH = 1 + LXF = 2 + PERSONAL = 3 PROJECT_TYPE = ( - (0, 'wired'), - (1, 'lbh'), - (2, 'personal'), - (3, 'lxf'), + (WIRED, 'wired'), + (LBH, 'lbh'), + (LXF, 'lxf'), + (PERSONAL, 'personal'), ) title = models.CharField(max_length=200) short_title = models.CharField(max_length=200, blank=True, null=True) @@ -116,32 +120,6 @@ class GTDNote(models.Model): (COMPLETED, 'Completed'), ] status = models.SmallIntegerField(choices=STATUS, default=OPEN) - CALLIN = 0 - ASKEDFOR = 1 - COMING = 2 - TESTING = 3 - DONE = 4 - LIVE = 5 - WORK_STATUS = ( - (CALLIN, 'Call In'), - (ASKEDFOR, 'Asked For'), - (COMING, 'Coming'), - (TESTING, 'Testing'), - (DONE, 'Done'), - (LIVE, 'Live'), - ) - work_status = models.SmallIntegerField(choices=WORK_STATUS, default=CALLIN) - NONE = 0 - GUIDE = 1 - REVIEW = 2 - RAVE = 3 - WORK_PLAN = ( - (GUIDE, 'For Guide'), - (REVIEW, 'Review'), - (RAVE, 'Rave/Rant'), - (NONE, 'No Plan'), - ) - work_plan = models.IntegerField(choices=WORK_PLAN, default=1) class Meta: ordering = ('-date_created',) diff --git a/app/gtd/templates/gtd/note_list.html b/app/gtd/templates/gtd/note_list.html index 203906b..1e5179e 100644 --- a/app/gtd/templates/gtd/note_list.html +++ b/app/gtd/templates/gtd/note_list.html @@ -2,8 +2,9 @@ {% block primary %} <main class="post-detail"> <div class="post-header"><ul class="flex header-list"> - {% for status in note_statuses %} - <li><a class="btn" href="{% url 'gtd:note-list-status' status.1|lower%}">{{status.1}}</a></li> + <li><a class="btn" href="{% url 'gtd:note-list' %}">All</a></li> + {% for object in note_types %} + <li><a class="btn" href="{% url 'gtd:note-list-status' object.1|lower%}">{{object.1}}</a></li> {% endfor %} <li class="right"><a href="{% url 'gtd:note-create' %}" class="btn">New Note</a></li> </ul> diff --git a/app/gtd/urls.py b/app/gtd/urls.py index 44c1a32..27a2dd8 100644 --- a/app/gtd/urls.py +++ b/app/gtd/urls.py @@ -13,7 +13,7 @@ urlpatterns = [ path( r'notes', views.GTDNoteListView.as_view(), - {'status':None}, + {'note_type':None}, name="note-list" ), path( @@ -22,7 +22,7 @@ urlpatterns = [ name="note-create" ), path( - r'note/<str:status>', + r'note/<str:note_type>', views.GTDNoteListView.as_view(), name="note-list-status" ), diff --git a/app/gtd/views.py b/app/gtd/views.py index 2a95925..8a32315 100644 --- a/app/gtd/views.py +++ b/app/gtd/views.py @@ -45,18 +45,29 @@ class GTDNoteListView(ListView): template_name = "gtd/note_list.html" def get_queryset(self): - if self.kwargs['status']: - status_reverse = dict((v, k) for k, v in GTDNote.STATUS) - status = status_reverse[self.kwargs['status'].title()] + if self.kwargs['note_type']: + status_reverse = dict((v, k) for k, v in GTDNote.NOTE_TYPE) + status = status_reverse[self.kwargs['note_type'].title()] return GTDNote.objects.filter(status=status) return GTDNote.objects.filter(status=1) def get_context_data(self, **kwargs): context = super(GTDNoteListView, self).get_context_data(**kwargs) - context['note_statuses'] = GTDNote.STATUS + context['note_types'] = GTDNote.NOTE_TYPE return context +class GTDNoteWiredListView(GTDNoteListView): + + def get_queryset(self): + if self.kwargs['status']: + status_reverse = dict((v, k) for k, v in GTDNote.STATUS) + status = status_reverse[self.kwargs['note_type'].title()] + return GTDNote.objects.filter(status=status) + return GTDNote.objects.filter(status=1) + + + class GTDNoteTODOView(ListView): model = GTDNote template_name = "gtd/note_list.html" |