diff options
author | luxagraf <sng@luxagraf.net> | 2023-11-17 16:03:19 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-11-17 16:03:19 -0500 |
commit | 6b1ae214361f533e53d8993a530e5d2b17c4f4e9 (patch) | |
tree | 6617a570f8ded12c300d9ea9025dc21962e1d613 | |
parent | 6d588f8ff8a9938699a2af14c33d80eb33dca818 (diff) |
gtd: fixed some bugs in RSS updater
-rw-r--r-- | app/gtd/management/commands/rss_updater.py | 6 | ||||
-rw-r--r-- | app/gtd/models.py | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/app/gtd/management/commands/rss_updater.py b/app/gtd/management/commands/rss_updater.py index 0f3796b..2e13fc9 100644 --- a/app/gtd/management/commands/rss_updater.py +++ b/app/gtd/management/commands/rss_updater.py @@ -1,4 +1,5 @@ from django.core.management.base import BaseCommand, CommandError +from django.core.exceptions import ObjectDoesNotExist import datetime import feedparser @@ -34,10 +35,13 @@ class Command(BaseCommand): post.date_last_pub = datetime.datetime.strptime(item.published, '%a, %d %b %Y %H:%M:%S %z').date() post.post_status = PostStatus.PUBLISHED post.save() + post = WiredPost.objects.get(url=item.link) + #print(post.date_last_pub) self.stdout.write( self.style.SUCCESS('Successfully updated post "%s"' % post.title) ) - except: + except ObjectDoesNotExist: + #print("skipping ", item.title) continue diff --git a/app/gtd/models.py b/app/gtd/models.py index f54ac3a..22af090 100644 --- a/app/gtd/models.py +++ b/app/gtd/models.py @@ -223,7 +223,7 @@ class WiredPost(models.Model): def save(self, *args, **kwargs): if self.date_last_pub: - td = timezone.localdate() - self.date_last_pub + td = datetime.date.today() - self.date_last_pub if td.days > self.update_frequency and self.post_status != 1: self.needs_update = True else: |