diff options
author | luxagraf <sng@luxagraf.net> | 2023-11-17 15:53:22 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-11-17 15:53:22 -0500 |
commit | 6d588f8ff8a9938699a2af14c33d80eb33dca818 (patch) | |
tree | 712d9aae52318aee9965a0354ec94f7da35564aa /app/gtd/management/commands/rss_updater.py | |
parent | f30c1b31e3427fd887551b42a9aec74ae292460f (diff) |
gtd: updated rss updater to work with new models
Diffstat (limited to 'app/gtd/management/commands/rss_updater.py')
-rw-r--r-- | app/gtd/management/commands/rss_updater.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/app/gtd/management/commands/rss_updater.py b/app/gtd/management/commands/rss_updater.py index 41ffa99..0f3796b 100644 --- a/app/gtd/management/commands/rss_updater.py +++ b/app/gtd/management/commands/rss_updater.py @@ -6,8 +6,7 @@ from urllib.parse import urlparse from django.contrib.auth import get_user_model -from posts.models import PostStatus, Post -User = get_user_model() +from gtd.models import PostStatus, WiredPost """ run from a cronscript that looks line this: @@ -31,7 +30,7 @@ class Command(BaseCommand): if story_type == "story" or "gallery": if not self.is_deal(item.tags): try: - post = Post.objects.get(url=item.link) + post = WiredPost.objects.get(url=item.link) 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() @@ -40,16 +39,21 @@ class Command(BaseCommand): ) except: continue + + + + + +''' if story_type == "review": """ TODO: add first and last names so I have everyone in the DB Then parse and add reviews, but change views so we don't see them in views where we just want a list of guides to update """ - user = User.objects.get(firstname=item.author.split(" ")[0],lastname=item.author.split(" ")[1]) dt = datetime.datetime.strptime(item.published, '%a, %d %b %Y %H:%M:%S %z').date() - post = Post.objects.get(url=item.link) + post = WiredPost.objects.get(url=item.link) user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL) title = models.CharField(max_length=512, blank=True, null=True) @@ -65,3 +69,4 @@ class Command(BaseCommand): needs_update = models.BooleanField(default=False) is_live = models.BooleanField(default=True) post_status = models.IntegerField(choices=PostStatus.choices, default=PostStatus.PUBLISHED) +''' |