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.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/gtd/views.py b/app/gtd/views.py
index cb3cefd..e0381d2 100644
--- a/app/gtd/views.py
+++ b/app/gtd/views.py
@@ -332,3 +332,30 @@ class GTDOutcomeDeleteView(DeleteView):
model = GTDOutcome
success_url = "/gtd/outcomes"
template_name = "gtd/confirm_delete.html"
+
+
+
+
+from datetime import datetime
+from bs4 import BeautifulSoup
+import requests
+
+def scrape_date(url):
+ return time
+
+class UpdateDateView(RedirectView):
+ permanent = False
+ url = "/gtd/wiredposts"
+ query_string = True
+
+ def get_redirect_url(self, *args, **kwargs):
+ for post in WiredPost.objects.all():
+ if post.url:
+ content = requests.get(url)
+ soup = BeautifulSoup(content.text, 'html.parser')
+ time = datetime.strptime(soup.time['datetime'][:-6], "%Y-%m-%dT%H:%M:%S").date()
+ if time != post.date_last_pub:
+ post.date_last_pub = time
+ post.save()
+ return super().get_redirect_url(*args, **kwargs)
+