From 9df5016226fbcf72e135df22fb54ed54c4c5f29a Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sun, 13 Oct 2013 11:51:47 +0200 Subject: First prototype for the /article page. --- pyaggr3g470r/models.py | 2 +- pyaggr3g470r/templates/article.html | 12 ++++++++++++ pyaggr3g470r/templates/home.html | 6 +++--- pyaggr3g470r/views.py | 10 ++++++++-- 4 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 pyaggr3g470r/templates/article.html (limited to 'pyaggr3g470r') diff --git a/pyaggr3g470r/models.py b/pyaggr3g470r/models.py index f1cac323..a36c27fe 100644 --- a/pyaggr3g470r/models.py +++ b/pyaggr3g470r/models.py @@ -47,7 +47,7 @@ class Article(DynamicDocument): like = BooleanField() retrieved_date = DateTimeField(required=True, default=datetime.now) - def __unicode__(self): + def __str__(self): return 'Article: %s' % self.title if __name__ == "__main__": diff --git a/pyaggr3g470r/templates/article.html b/pyaggr3g470r/templates/article.html new file mode 100644 index 00000000..9c4fe287 --- /dev/null +++ b/pyaggr3g470r/templates/article.html @@ -0,0 +1,12 @@ +{% extends "layout.html" %} +{% block content %} +
+
+

{{ article.title }}

+
{{ article.date }}
+
+
+ {{ article.content|safe }} +
+
+{% endblock %} \ No newline at end of file diff --git a/pyaggr3g470r/templates/home.html b/pyaggr3g470r/templates/home.html index 76104e68..b6e24a50 100644 --- a/pyaggr3g470r/templates/home.html +++ b/pyaggr3g470r/templates/home.html @@ -11,19 +11,19 @@
{% if feed.articles[number].readed %}

{% else %}

{% endif %} - {{ feed.articles[number].title }}

+ {{ feed.articles[number].title }}

{% if feed.articles[number].readed %}

{% else %}{% endif %}
{{ feed.articles[number].date }}
{% if feed.articles[number+1].readed %}

{% else %}

{% endif %} - {{ feed.articles[number+1].title }}

+ {{ feed.articles[number+1].title }}

{% if feed.articles[number+1].readed %}

{% else %}{% endif %}
{{ feed.articles[number+1].date }}
{% if feed.articles[number+2].readed %}

{% else %}

{% endif %} - {{ feed.articles[number+2].title }}

+ {{ feed.articles[number+2].title }}

{% if feed.articles[number+2].readed %}

{% else %}{% endif %}
{{ feed.articles[number+2].date }}
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index 9ca5d163..eb1bf0c0 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -35,5 +35,11 @@ def feeds(): @app.route('/feed/', methods=['GET']) def feed(feed_id=None): - feed = models.Watch.objects(id=feed_id).first() - return render_template('feed.html', feed=feed) \ No newline at end of file + feed = models.Article.objects(id=feed_id).first() + return render_template('feed.html', feed=feed) + +@app.route('/article/', methods=['GET']) +def article(article_id=None): + article = models.Article.objects(id=article_id).first() + print article.content + return render_template('article.html', article=article) \ No newline at end of file -- cgit