diff options
author | luxagraf <sng@luxagraf.net> | 2023-07-24 13:44:50 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-07-24 13:44:50 -0500 |
commit | d5c3fdc2be4cf7e19102218aea980ff2f52fc02b (patch) | |
tree | bce34d7a9e66ebd1556b14bae95141efc7fb5ce1 /app | |
parent | 1dc0faaf94b8ffcd93b303839133849bfeea0848 (diff) |
notes: added option to not filter notes
Diffstat (limited to 'app')
-rw-r--r-- | app/notes/urls.py | 1 | ||||
-rw-r--r-- | app/notes/views.py | 15 |
2 files changed, 10 insertions, 6 deletions
diff --git a/app/notes/urls.py b/app/notes/urls.py index 760f0c3..ecf7c5c 100644 --- a/app/notes/urls.py +++ b/app/notes/urls.py @@ -8,6 +8,7 @@ urlpatterns = [ path( r'', views.NoteListView.as_view(), + {'status':None}, name="list" ), path( diff --git a/app/notes/views.py b/app/notes/views.py index 70f20c6..86ad574 100644 --- a/app/notes/views.py +++ b/app/notes/views.py @@ -38,9 +38,12 @@ class NoteListView(ListView): model = Note def get_queryset(self): - if self.kwargs['status'] == "todo": - status = "Call In" - else: - status = self.kwargs['status'] - status_reverse = dict((v, k) for k, v in Note.STATUS) - return Note.objects.filter(user=self.request.user).filter(status=status_reverse[status]) + if self.kwargs['status']: + if self.kwargs['status'] == "todo": + status = "Call In" + else: + status = self.kwargs['status'] + status_reverse = dict((v, k) for k, v in Note.STATUS) + qs = Note.objects.filter(user=self.request.user).filter(status=status_reverse[status]) + qs = Note.objects.filter(user=self.request.user) + return qs |