aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/models.py
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-10-27 17:45:21 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-10-27 17:45:21 +0100
commit2aaf32143621cad5c1cecd714e6b63413ef7edc8 (patch)
treeb2df6b147a74ba690c2045d8d3608bc512d44c3f /pyaggr3g470r/models.py
parentSort articles on the main page. (diff)
downloadnewspipe-2aaf32143621cad5c1cecd714e6b63413ef7edc8.tar.gz
newspipe-2aaf32143621cad5c1cecd714e6b63413ef7edc8.tar.bz2
newspipe-2aaf32143621cad5c1cecd714e6b63413ef7edc8.zip
Updated importer.
Diffstat (limited to 'pyaggr3g470r/models.py')
-rw-r--r--pyaggr3g470r/models.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/pyaggr3g470r/models.py b/pyaggr3g470r/models.py
index e9f115d1..58b350ea 100644
--- a/pyaggr3g470r/models.py
+++ b/pyaggr3g470r/models.py
@@ -78,7 +78,7 @@ if __name__ == "__main__":
for feed in feeds:
articles = []
feed_articles = mongo.get_articles(feed["feed_id"])
- #feed_articles = sorted(feed_articles, key=lambda t: t['article_date'], reverse=True)
+ feed_articles = sorted(feed_articles, key=lambda t: t['article_date'], reverse=True)
for article in feed_articles:
article1 = Article(date=article["article_date"], link=article["article_link"], \
title=article["article_title"], content=article["article_content"], \
@@ -86,19 +86,11 @@ if __name__ == "__main__":
retrieved_date=article["article_date"])
articles.append(article1)
- try:
- article1.save()
- except:
- # pas de méthode save() pour un objet EmbeddedDocument.
- pass
+ article1.save()
sorted(articles, key=lambda t: t.date, reverse=True)
feed1 = Feed(title=feed["feed_title"], link=feed["feed_link"],
site_link=feed["site_link"], mail=feed["mail"],
articles=articles)
- feed1.save()
-
-
- #for feed in Feed.objects:
- #print(feed.articles[0].title) \ No newline at end of file
+ feed1.save() \ No newline at end of file
bgstack15