diff options
| author | Lucas Verney <phyks@phyks.me> | 2018-12-25 16:50:14 +0100 |
|---|---|---|
| committer | Alexis Metaireau <alexis@notmyidea.org> | 2018-12-25 16:50:14 +0100 |
| commit | 0428cf06b50203432cb39bde95e450a481392797 (patch) | |
| tree | 0af70aa16da50a850eeb4fd15fbb46c0bcf59955 /ihatemoney/models.py | |
| parent | 0f2a5e9255034e4e4f93922c8178e166c9ef41a3 (diff) | |
| download | ihatemoney-mirror-0428cf06b50203432cb39bde95e450a481392797.zip ihatemoney-mirror-0428cf06b50203432cb39bde95e450a481392797.tar.gz ihatemoney-mirror-0428cf06b50203432cb39bde95e450a481392797.tar.bz2 | |
Add bill.creation_date field (#327)
Diffstat (limited to 'ihatemoney/models.py')
| -rw-r--r-- | ihatemoney/models.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ihatemoney/models.py b/ihatemoney/models.py index c6ce23f..9e9fbeb 100644 --- a/ihatemoney/models.py +++ b/ihatemoney/models.py @@ -163,6 +163,7 @@ class Project(db.Model): .filter(Bill.payer_id == Person.id)\ .filter(Person.project_id == Project.id)\ .filter(Project.id == self.id)\ + .order_by(Bill.creation_date.desc())\ .order_by(Bill.date.desc())\ .order_by(Bill.id.desc()) @@ -329,7 +330,8 @@ class Bill(db.Model): query_class = BillQuery - _to_serialize = ("id", "payer_id", "owers", "amount", "date", "what") + _to_serialize = ("id", "payer_id", "owers", "amount", "date", + "creation_date", "what") id = db.Column(db.Integer, primary_key=True) @@ -338,6 +340,7 @@ class Bill(db.Model): amount = db.Column(db.Float) date = db.Column(db.Date, default=datetime.now) + creation_date = db.Column(db.Date, default=datetime.now) what = db.Column(db.UnicodeText) archive = db.Column(db.Integer, db.ForeignKey("archive.id")) |
