summaryrefslogtreecommitdiff
path: root/app/posts
diff options
context:
space:
mode:
Diffstat (limited to 'app/posts')
-rw-r--r--app/posts/management/commands/rss_updater.py27
-rw-r--r--app/posts/templates/posts/post_table.html5
-rw-r--r--app/posts/views.py2
3 files changed, 30 insertions, 4 deletions
diff --git a/app/posts/management/commands/rss_updater.py b/app/posts/management/commands/rss_updater.py
index ad8551b..41ffa99 100644
--- a/app/posts/management/commands/rss_updater.py
+++ b/app/posts/management/commands/rss_updater.py
@@ -4,8 +4,10 @@ import datetime
import feedparser
from urllib.parse import urlparse
-from posts.models import PostStatus, Post
+from django.contrib.auth import get_user_model
+from posts.models import PostStatus, Post
+User = get_user_model()
"""
run from a cronscript that looks line this:
@@ -38,5 +40,28 @@ 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)
+ user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL)
+ title = models.CharField(max_length=512, blank=True, null=True)
+ body = models.TextField(blank=True, null=True)
+ url = models.CharField(max_length=512, blank=True, null=True)
+ date_last_pub = models.DateField()
+ guid = models.CharField(max_length=512, blank=True, null=True, db_index=True)
+ author = models.CharField(max_length=255, blank=True, null=True)
+ post_type = models.IntegerField(choices=PostType.choices, default=PostType.GUIDE)
+ template_type = models.IntegerField(choices=TemplateType.choices, default=TemplateType.STORY)
+ update_frequency = models.BigIntegerField(help_text="In days")
+ products = models.ManyToManyField(ProductLink, blank=True, null=True)
+ needs_update = models.BooleanField(default=False)
+ is_live = models.BooleanField(default=True)
+ post_status = models.IntegerField(choices=PostStatus.choices, default=PostStatus.PUBLISHED)
diff --git a/app/posts/templates/posts/post_table.html b/app/posts/templates/posts/post_table.html
index 4779149..d9040e3 100644
--- a/app/posts/templates/posts/post_table.html
+++ b/app/posts/templates/posts/post_table.html
@@ -66,13 +66,14 @@ Date last pub
</a>
</td>
<td class="field-date_last_pub nowrap">{{object.date_last_pub}}</td>
- <td class="field-post_type"><span class="hide">{{object.post_type}}</span>{{object.get_post_type_display}}</td>
+ <td class="field-post_type"><span class="hide">{{object.post_type}}</span>{{object.get_plan_display}}</td>
<td class="field-update_frequency">{{object.update_frequency}}</td>
<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%}
</td>
- <td class="field-days_overdue">{{object.days_overdue}}</td></tr>
+ <td class="field-days_overdue">{{object.days_overdue}}</td>
+ <td class="field-days_overdue"><a href="{% url 'notes:edit' object.pk %}">edit</a></td></tr>
</tr>{% endfor %}{% endif %}
</tbody>
</table>
diff --git a/app/posts/views.py b/app/posts/views.py
index 29796c4..40368df 100644
--- a/app/posts/views.py
+++ b/app/posts/views.py
@@ -47,7 +47,7 @@ class PostTodoView(LoginRequiredMixin, ListView):
def get_context_data(self, **kwargs):
context = super(PostTodoView, self).get_context_data(**kwargs)
- context['reviews'] = Note.objects.filter(plan=1)
+ context['reviews'] = Note.objects.filter(plan__in=[1,2,3]).exclude(status=4)
return context