aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyaggr3g470r/models.py')
-rw-r--r--pyaggr3g470r/models.py38
1 files changed, 0 insertions, 38 deletions
diff --git a/pyaggr3g470r/models.py b/pyaggr3g470r/models.py
index 1a573ca2..38d1e6ec 100644
--- a/pyaggr3g470r/models.py
+++ b/pyaggr3g470r/models.py
@@ -96,41 +96,3 @@ class Article(Document):
def __str__(self):
return 'Article: %s' % self.title
-
-if __name__ == "__main__":
- # Point of entry in execution mode
- db = connect('pyaggr3g470r1')
- db.drop_database('pyaggr3g470r1')
-
-
- from werkzeug import generate_password_hash
- password = generate_password_hash("admin")
- user1 = User(firstname="Cédric", lastname="Bonhomme", \
- email="kimble.mandel@gmail.com", pwdhash=generate_password_hash("admin"))
- user1.save()
-
- import mongodb
- mongo = mongodb.Articles("127.0.0.1", 27017, \
- "pyaggr3g470r", "***", "")
- feeds = mongo.get_all_feeds()
- 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)
- for article in feed_articles:
- article1 = Article(date=article["article_date"], link=article["article_link"], \
- title=article["article_title"], content=article["article_content"], \
- readed=article["article_readed"], like=article["article_like"], \
- retrieved_date=article["article_date"])
-
- articles.append(article1)
- 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()
- user1.feeds.append(feed1)
- user1.save() \ No newline at end of file
bgstack15