aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/models.py
diff options
context:
space:
mode:
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