aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2014-04-08 08:23:38 +0200
committerCédric Bonhomme <kimble.mandel@gmail.com>2014-04-08 08:23:38 +0200
commit0483c5c3d5c5d82656e6d66f7d7c28f332b8e4d2 (patch)
tree37c91ed8c11d1e659b8c7ad20f57cfc31d5306ef
parentManagement page near to be OK. (diff)
downloadnewspipe-0483c5c3d5c5d82656e6d66f7d7c28f332b8e4d2.tar.gz
newspipe-0483c5c3d5c5d82656e6d66f7d7c28f332b8e4d2.tar.bz2
newspipe-0483c5c3d5c5d82656e6d66f7d7c28f332b8e4d2.zip
Sort articles by date.
-rw-r--r--pyaggr3g470r/models.py4
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'))
bgstack15