From 15c6f1153c694594a8d49fc0cf2bb3f939990455 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Sun, 3 Dec 2023 15:42:28 -0500 Subject: gtd: added a better way of dealing with overdue updates --- app/gtd/templates/gtd/wiredpost_table.html | 2 +- app/gtd/urls.py | 5 +++++ app/gtd/views.py | 13 ++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/gtd/templates/gtd/wiredpost_table.html b/app/gtd/templates/gtd/wiredpost_table.html index 8ea91e6..fc7d440 100644 --- a/app/gtd/templates/gtd/wiredpost_table.html +++ b/app/gtd/templates/gtd/wiredpost_table.html @@ -5,6 +5,7 @@ {% block primary %}
+
update overdue
@@ -58,7 +59,6 @@ Date last pub diff --git a/app/gtd/urls.py b/app/gtd/urls.py index c47e968..565ea6b 100644 --- a/app/gtd/urls.py +++ b/app/gtd/urls.py @@ -98,6 +98,11 @@ urlpatterns = [ views.WiredPostListView.as_view(), name="wiredpost-list" ), + path( + r'wiredposts/update-overdue', + views.WiredPostUpdateOverdueView.as_view(), + name="wiredpost-update-overdue" + ), path( r'wiredpost/create', views.WiredPostCreateView.as_view(), diff --git a/app/gtd/views.py b/app/gtd/views.py index eaa14a6..41a1d9f 100644 --- a/app/gtd/views.py +++ b/app/gtd/views.py @@ -1,4 +1,4 @@ -from django.views.generic import UpdateView, DetailView, ListView, CreateView, DeleteView +from django.views.generic import UpdateView, DetailView, ListView, CreateView, DeleteView, RedirectView from django.urls import reverse, reverse_lazy from django.db.models import Q @@ -217,6 +217,17 @@ class WiredPostListView(ListView): return WiredPost.objects.all().order_by("-needs_update") +class WiredPostUpdateOverdueView(RedirectView): + permanent = False + url = "/gtd/wiredposts" + query_string = True + + def get_redirect_url(self, *args, **kwargs): + for post in WiredPost.objects.all(): + post.set_needs_update() + return super().get_redirect_url(*args, **kwargs) + + class WiredPostNewView(ListView): template_name = 'gtd/wiredpost_list.html' -- cgit v1.2.3-70-g09d2
{% if object.needs_update %} 1True{%else%} 0False{%endif%} - {{object.set_needs_update}} {{object.days_overdue}} edit