summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/gtd/templates/gtd/wiredpost_table.html2
-rw-r--r--app/gtd/urls.py5
-rw-r--r--app/gtd/views.py13
3 files changed, 18 insertions, 2 deletions
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 %}
<main class="content">
<div class="results">
+ <div style="font-size:11px; text-align: right;"><a href="{% url 'gtd:wiredpost-update-overdue' %}">update overdue</a></div>
<table class="sortable" id="result_list">
<thead>
<tr>
@@ -58,7 +59,6 @@ Date last pub
<td class="field-needs_update">{% if object.needs_update %}
<span class="hide">1</span><img src="/static/admin/img/icon-yes.svg" alt="True">{%else%}
<span class="hide">0</span><img src="/static/admin/img/icon-no.svg" alt="False">{%endif%}
- {{object.set_needs_update}}
</td>
<td class="field-days_overdue">{{object.days_overdue}}</td>
<td class="field-days_overdue"><a href="{% url 'gtd:wiredpost-edit' object.pk %}">edit</a></td></tr>
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
@@ -99,6 +99,11 @@ urlpatterns = [
name="wiredpost-list"
),
path(
+ r'wiredposts/update-overdue',
+ views.WiredPostUpdateOverdueView.as_view(),
+ name="wiredpost-update-overdue"
+ ),
+ path(
r'wiredpost/create',
views.WiredPostCreateView.as_view(),
name="wiredpost-create"
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'