{{ entry.title }}
+{{ entry.title|striptags|truncatewords_html:10 }}
- {{ entry.content|striptags|truncatewords_html:40 }}
-
{{ entry.author }}
+ {{ entry.author }}
+ {{ entry.content|striptags|truncatewords_html:25 }}
diff --git a/feedler/feedparser.py b/feedler/feedparser.py
index ed83a1f..bc39f98 100644
--- a/feedler/feedparser.py
+++ b/feedler/feedparser.py
@@ -12,7 +12,7 @@ def parse(obj, raw, stream):
# Date stamp handling
ts = raw['published'] / 1000
- obj.published = datetime.utcfromtimestamp(ts)
+ obj.published = datetime.fromtimestamp(ts)
# Authorship and title
obj.title = raw['title']
@@ -32,6 +32,8 @@ def parse(obj, raw, stream):
obj.visual = raw['enclosure'][0]['href']
elif 'visual' in raw and 'url' in raw['visual']:
obj.visual = raw['visual']['url']
+ if obj.visual.lower().strip() == 'none':
+ obj.visual = ''
# Collect text in nested JSON content
if 'content' in obj.raw:
diff --git a/feedler/models/admin.py b/feedler/models/admin.py
index 43c0298..604b92f 100644
--- a/feedler/models/admin.py
+++ b/feedler/models/admin.py
@@ -12,6 +12,7 @@ from django.core.mail import send_mail
from wagtail.contrib.settings.models import BaseSetting, register_setting
from .models import Entry, Stream
+import feedler.feedparser as feedparser
import logging
logger = logging.getLogger('feedler')
@@ -60,5 +61,5 @@ def handle_save_settings(sender, instance, *args, **kwargs):
except Entry.DoesNotExist:
logger.info("Adding entry '%s'" % eid)
entry = Entry()
- entry.parse(raw_entry, stream)
+ entry = feedparser.parse(entry, raw_entry, stream)
entry.save()
diff --git a/feedler/models/models.py b/feedler/models/models.py
index bb256f9..8777e58 100644
--- a/feedler/models/models.py
+++ b/feedler/models/models.py
@@ -6,8 +6,6 @@ from wagtail.wagtailcore.models import Page, Orderable
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailcore.fields import RichTextField
-import feedler.feedparser as feedparser
-
class Stream(models.Model):
title = models.CharField(max_length=255)
ident = models.CharField(max_length=255)
@@ -38,10 +36,6 @@ class Entry(models.Model):
class Meta:
verbose_name_plural = 'Entries'
- def parse(self, raw, stream):
- # TODO: Exception handling
- feedparser.parse(self, raw, stream)
-
class FeedPage(Page):
intro = RichTextField(default='', blank=True)
stream = models.ForeignKey(Stream, on_delete=models.PROTECT,
diff --git a/feedler/templates/feedler/feed_page.html b/feedler/templates/feedler/feed_page.html
index 392be5c..df5c33e 100644
--- a/feedler/templates/feedler/feed_page.html
+++ b/feedler/templates/feedler/feed_page.html
@@ -13,7 +13,9 @@
{{ page.intro|richtext }} {{ page.intro|richtext }}{{ page.title }}
-
- {{ entry.content|striptags|truncatewords_html:40 }}
-
{{ entry.author }}
+ {{ entry.author }}
+ {{ entry.content|striptags|truncatewords_html:25 }}