diff options
| author | Baptiste Jonglez <git@bitsofnetworks.org> | 2017-01-02 13:22:28 +0100 |
|---|---|---|
| committer | Baptiste Jonglez <git@bitsofnetworks.org> | 2017-01-02 13:22:28 +0100 |
| commit | 699db1c4c8d95c3fc1adc3c0eca97f5f737e3512 (patch) | |
| tree | af6ec06834c042f1bc64013412b7c621194fba5c | |
| parent | 4d5c8a507b3bce8d4802b57ab3b34e5a4cb3750e (diff) | |
| download | ihatemoney-mirror-699db1c4c8d95c3fc1adc3c0eca97f5f737e3512.zip ihatemoney-mirror-699db1c4c8d95c3fc1adc3c0eca97f5f737e3512.tar.gz ihatemoney-mirror-699db1c4c8d95c3fc1adc3c0eca97f5f737e3512.tar.bz2 | |
Sort bills by (date.desc, ID.desc) instead of just date.desc
When viewing the list of bills, bills are (correctly) sorted by date. But
the order of all bills for a given day is not intuitive: I would expect
bills to be sorted by reverse order of insertion. That is, the last bill
to be added for a given day should appear first, not last. Otherwise,
when adding several bills in a row for a given day, it's confusing to see
that the new bills do not appear on top of the list.
Fix this by sorting by decreasing ID after sorting by date.
| -rw-r--r-- | budget/models.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/budget/models.py b/budget/models.py index 852b3e1..9538670 100644 --- a/budget/models.py +++ b/budget/models.py @@ -111,7 +111,8 @@ class Project(db.Model): .filter(Bill.payer_id == Person.id)\ .filter(Person.project_id == Project.id)\ .filter(Project.id == self.id)\ - .order_by(Bill.date.desc()) + .order_by(Bill.date.desc())\ + .order_by(Bill.id.desc()) def remove_member(self, member_id): """Remove a member from the project. |
