aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-01-26 18:25:38 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-01-26 18:25:38 +0100
commit1c7d27938a47ab3739400867351ef00652440217 (patch)
treed3ca6875f5d3e2fc7ae8a920486e04e72432adbb
parentAdded an option to choose if URL of articles behind proxies should be resolved. (diff)
downloadnewspipe-1c7d27938a47ab3739400867351ef00652440217.tar.gz
newspipe-1c7d27938a47ab3739400867351ef00652440217.tar.bz2
newspipe-1c7d27938a47ab3739400867351ef00652440217.zip
The description of the feed is stored in the database.
-rw-r--r--pyaggr3g470r/feedgetter.py6
-rw-r--r--pyaggr3g470r/models.py1
-rw-r--r--pyaggr3g470r/templates/feed.html3
-rw-r--r--pyaggr3g470r/views.py2
4 files changed, 11 insertions, 1 deletions
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 @@
<div class="container">
<div class="jumbotron">
<h2>{{ feed.title }}</h2>
+ {% if feed.description %} <p>{{ feed.description }}</p> {% endif %}
<a href="/delete_feed/{{ feed.oid }}"><i class="glyphicon glyphicon-remove" title="Delete this feed"></i></a>
<a href="/edit_feed/{{ feed.oid }}"><i class="glyphicon glyphicon-edit" title="Edit this feed"></i></a>
+ </div>
+ <div class="jumbotron">
<p>This feed contains {{ feed.articles|count }} <a href="/articles/{{ feed.oid }}">articles</a>.</p>
<p>Address of the feed: <a href="{{ feed.link }}">{{ feed.link }}</a>.</p>
<p>Address of the site: <a href="{{ feed.site_link }}">{{ feed.site_link }}</a>.</p>
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)
bgstack15