diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2014-04-08 08:23:38 +0200 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2014-04-08 08:23:38 +0200 |
commit | 0483c5c3d5c5d82656e6d66f7d7c28f332b8e4d2 (patch) | |
tree | 37c91ed8c11d1e659b8c7ad20f57cfc31d5306ef /pyaggr3g470r/models.py | |
parent | Management page near to be OK. (diff) | |
download | newspipe-0483c5c3d5c5d82656e6d66f7d7c28f332b8e4d2.tar.gz newspipe-0483c5c3d5c5d82656e6d66f7d7c28f332b8e4d2.tar.bz2 newspipe-0483c5c3d5c5d82656e6d66f7d7c28f332b8e4d2.zip |
Sort articles by date.
Diffstat (limited to 'pyaggr3g470r/models.py')
-rw-r--r-- | pyaggr3g470r/models.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pyaggr3g470r/models.py b/pyaggr3g470r/models.py index caed0ef2..230d1021 100644 --- a/pyaggr3g470r/models.py +++ b/pyaggr3g470r/models.py @@ -27,6 +27,7 @@ __copyright__ = "Copyright (c) Cedric Bonhomme" __license__ = "GPLv3" from datetime import datetime +from sqlalchemy import desc from werkzeug import generate_password_hash, check_password_hash from flask.ext.login import UserMixin from pyaggr3g470r import db @@ -96,7 +97,8 @@ class Feed(db.Model): email_notification = db.Column(db.Boolean(), default=False) enabled = db.Column(db.Boolean(), default=True) created_date = db.Column(db.DateTime(), default=datetime.now) - articles = db.relationship('Article', backref = 'feed', lazy = 'dynamic', cascade='all,delete-orphan') + articles = db.relationship('Article', backref = 'feed', lazy = 'dynamic', cascade='all,delete-orphan', + order_by=desc("Article.date")) user_id = db.Column(db.Integer, db.ForeignKey('user.id')) |