aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r--pyaggr3g470r/views.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index f77b49e2..02495311 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -242,13 +242,16 @@ def delete(article_id=None):
flash('Impossible to delete the article.', 'danger')
return redirect(url_for('home'))
-@app.route('/articles/<feed_id>', methods=['GET'])
+@app.route('/articles/<feed_id>/', methods=['GET'])
+@app.route('/articles/<feed_id>/<int:nb_articles>', methods=['GET'])
@login_required
-def articles(feed_id=None):
+def articles(feed_id=None, nb_articles=-1):
user = models.User.objects(email=g.user.email, feeds__oid=feed_id).first()
for feed in user.feeds:
if str(feed.oid) == feed_id:
- return render_template('articles.html', feed=feed)
+ if nb_articles != -1:
+ feed.articles = feed.articles[0:nb_articles]
+ return render_template('articles.html', feed=feed, nb_articles=nb_articles)
@app.route('/favorites/', methods=['GET'])
@login_required
bgstack15