From 1c7d27938a47ab3739400867351ef00652440217 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sun, 26 Jan 2014 18:25:38 +0100 Subject: The description of the feed is stored in the database. --- pyaggr3g470r/feedgetter.py | 6 ++++++ pyaggr3g470r/models.py | 1 + pyaggr3g470r/templates/feed.html | 3 +++ pyaggr3g470r/views.py | 2 +- 4 files changed, 11 insertions(+), 1 deletion(-) (limited to 'pyaggr3g470r') diff --git a/pyaggr3g470r/feedgetter.py b/pyaggr3g470r/feedgetter.py index d29d3c9e..59b22c38 100644 --- a/pyaggr3g470r/feedgetter.py +++ b/pyaggr3g470r/feedgetter.py @@ -106,6 +106,12 @@ class FeedGetter(object): if a_feed['entries'] == []: return + # Feed informations + if feed.title == "": + feed.title = a_feed.feed.title + if feed.description == "": + feed.description = a_feed.feed.subtitle + articles = [] for article in a_feed['entries']: diff --git a/pyaggr3g470r/models.py b/pyaggr3g470r/models.py index 4a2b4983..00605b2a 100644 --- a/pyaggr3g470r/models.py +++ b/pyaggr3g470r/models.py @@ -64,6 +64,7 @@ class Feed(EmbeddedDocument): """ oid = ObjectIdField(default=bson.objectid.ObjectId , primary_key=True) title = StringField(required=True) + description = StringField(required=True) link = StringField(required=True, unique=True) site_link = StringField(required=True) email_notification = BooleanField(default=False) diff --git a/pyaggr3g470r/templates/feed.html b/pyaggr3g470r/templates/feed.html index 9825e16b..c405d913 100644 --- a/pyaggr3g470r/templates/feed.html +++ b/pyaggr3g470r/templates/feed.html @@ -3,8 +3,11 @@

{{ feed.title }}

+ {% if feed.description %}

{{ feed.description }}

{% endif %} +
+

This feed contains {{ feed.articles|count }} articles.

Address of the feed: {{ feed.link }}.

Address of the site: {{ feed.site_link }}.

diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index 1c1b1237..5e68febb 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -372,7 +372,7 @@ def edit_feed(feed_id=None): # Create a new feed existing_feed = [feed for feed in user.feeds if feed.link == form.link.data] if len(existing_feed) == 0: - new_feed = models.Feed(title=form.title.data, link=form.link.data, \ + new_feed = models.Feed(title=form.title.data, description="", link=form.link.data, \ site_link=form.site_link.data, email=form.email_notification.data, \ enabled=form.enabled.data) user.feeds.append(new_feed) -- cgit