summaryrefslogtreecommitdiff
path: root/app/gtd/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/gtd/views.py')
-rw-r--r--app/gtd/views.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/app/gtd/views.py b/app/gtd/views.py
index 235867d..db014b1 100644
--- a/app/gtd/views.py
+++ b/app/gtd/views.py
@@ -52,23 +52,18 @@ class GTDNoteListView(ListView):
template_name = "gtd/note_list.html"
def get_queryset(self):
+ project = self.request.GET.get("project", False)
if self.kwargs['note_type']:
print(self.kwargs['note_type'])
note_type_reverse = dict((v, k) for k, v in GTDNote.NOTE_TYPE)
note_type = note_type_reverse[self.kwargs['note_type'].title()]
- try:
- project = self.request.GET["project"]
- print(project)
+ if project:
return GTDNote.objects.filter(note_type=note_type, project__title=project)
- except:
- return GTDNote.objects.filter(note_type=note_type)
+ return GTDNote.objects.filter(note_type=note_type)
else:
- try:
- project = self.request.GET["project"]
- print(project)
+ if project:
return GTDNote.objects.filter(project__title=project)
- except:
- return GTDNote.objects.all()
+ return GTDNote.objects.all()
def get_context_data(self, **kwargs):
context = super(GTDNoteListView, self).get_context_data(**kwargs)
@@ -179,15 +174,23 @@ class WiredNoteListView(ListView):
template_name = "gtd/wirednote_list.html"
def get_queryset(self):
+ wiredpost = self.request.GET.get("post", False)
if self.kwargs['status']:
status_reverse = dict((v, k) for k, v in WiredNote.STATUS)
status = status_reverse[self.kwargs['status'].title()]
+ if wiredpost:
+ return WiredNote.objects.filter(status=status, post__title=wiredpost)
return WiredNote.objects.filter(status=status)
+ else:
+ if wiredpost:
+ return WiredNote.objects.filter(post__title=wiredpost)
return WiredNote.objects.all()
def get_context_data(self, **kwargs):
context = super(WiredNoteListView, self).get_context_data(**kwargs)
context['note_statuses'] = WiredNote.STATUS
+ context['posts'] = WiredPost.objects.all()
+ context['post'] = self.request.GET.get("post", False)
return context