diff options
author | luxagraf <sng@luxagraf.net> | 2023-11-16 16:01:47 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-11-16 16:01:47 -0500 |
commit | 7423fe6beee166b4bacdc728ae98d2fea2fe3773 (patch) | |
tree | 081ea1f994f4be8aa09c97bde0a2afbbf7357dc0 | |
parent | eb0d17996d2ba0630045b329a4f21e8f4723d6e6 (diff) |
gtd: fixed a datetime bug
-rw-r--r-- | app/gtd/models.py | 6 | ||||
-rw-r--r-- | app/gtd/views.py | 9 |
2 files changed, 6 insertions, 9 deletions
diff --git a/app/gtd/models.py b/app/gtd/models.py index e3d49ce..af6ca69 100644 --- a/app/gtd/models.py +++ b/app/gtd/models.py @@ -44,9 +44,9 @@ class GTDOutcome(models.Model): class GTDProject(models.Model): PROJECT_TYPE = ( - (0, 'Wired'), + (0, 'wired'), (1, 'lbh'), - (2, 'Personal'), + (2, 'personal'), (3, 'lxf'), ) title = models.CharField(max_length=200) @@ -168,7 +168,7 @@ class WiredPost(models.Model): return self.title def time_since_update(self): - td = timezone.localdate() - self.date_last_pub + td = datetime.date.today() - self.date_last_pub return int(td.days) #def get_needs_update(self): diff --git a/app/gtd/views.py b/app/gtd/views.py index fc96187..a3b7eab 100644 --- a/app/gtd/views.py +++ b/app/gtd/views.py @@ -97,15 +97,12 @@ class GTDProjectListView(ListView): model = GTDProject template_name = "gtd/project_list.html" - def get_queryset(self): - print("hello world") - print(self.kwargs['project_type']) + def get_queryset(self, *args, **kwargs): if self.kwargs['project_type']: project_type_reverse = dict((v, k) for k, v in GTDProject.PROJECT_TYPE) - project_type = project_type_reverse[self.kwargs['project_type'].title()] + project_type = project_type_reverse[self.kwargs['project_type']] return GTDProject.objects.filter(project_type=project_type) - context = super(GTDProjectListView, self).get_context_data(**kwargs) - return context + return GTDProject.objects.all() def get_context_data(self, **kwargs): context = super(GTDProjectListView, self).get_context_data(**kwargs) |