aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-11-10 14:46:40 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-11-10 14:46:40 +0100
commit331de630ace4664fc7a6a10b89d7cb85a0f05839 (patch)
tree40f457e35f9494402a4c0cabd8becbc47c8f3695 /pyaggr3g470r
parentEnable or disable email notification. (diff)
downloadnewspipe-331de630ace4664fc7a6a10b89d7cb85a0f05839.tar.gz
newspipe-331de630ace4664fc7a6a10b89d7cb85a0f05839.tar.bz2
newspipe-331de630ace4664fc7a6a10b89d7cb85a0f05839.zip
Mark or unmark an article as favorites.
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/templates/article.html4
-rw-r--r--pyaggr3g470r/views.py11
2 files changed, 13 insertions, 2 deletions
diff --git a/pyaggr3g470r/templates/article.html b/pyaggr3g470r/templates/article.html
index 51f7c485..315bb6f4 100644
--- a/pyaggr3g470r/templates/article.html
+++ b/pyaggr3g470r/templates/article.html
@@ -9,9 +9,9 @@
<h2><a href="{{ article.link }}">{{ article.title }}</a></h2>
<a href="/delete/{{ article.id }}"><i class="glyphicon glyphicon-remove" title="Delete this article"></i></a>
{% if article.like %}
- <i class="glyphicon glyphicon-star" title="One of your favorites"></i>
+ <a href="/like/{{ article.id }}"><i class="glyphicon glyphicon-star" title="One of your favorites"></i></a>
{% else %}
- <i class="glyphicon glyphicon-star-empty" title="Click if you like this article"></i>
+ <a href="/like/{{ article.id }}"><i class="glyphicon glyphicon-star-empty" title="Click if you like this article"></i></a>
{% endif %}
<h6>{{ article.date }}</h6>
</div>
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 79a53ca0..96d34aea 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -146,6 +146,17 @@ def mark_as_read():
models.Article.objects(readed=False).update(set__readed=True)
return redirect(url_for('home'))
+@app.route('/like/<article_id>', methods=['GET'])
+@login_required
+def like(article_id=None):
+ """
+ Mark or unmark an article as favorites.
+ """
+ #user = models.User.objects(email=g.user.email).first()
+ models.Article.objects(id=article_id).update(set__like= \
+ (not models.Article.objects(id=article_id).first().like))
+ return redirect("/article/"+article_id)
+
@app.route('/delete/<article_id>', methods=['GET'])
@login_required
def delete(article_id=None):
bgstack15