summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2019-10-25 07:49:57 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2019-10-25 08:04:17 (GMT)
commit226f93dbd7a891ef640d80d77e799461c73a7f92 (patch)
tree2b35afee4237b4a1e41fca6414653d4daa071b59
parent0f0353266e3641b6828115fc238af97535cb9c77 (diff)
downloadcombo-226f93dbd7a891ef640d80d77e799461c73a7f92.zip
combo-226f93dbd7a891ef640d80d77e799461c73a7f92.tar.gz
combo-226f93dbd7a891ef640d80d77e799461c73a7f92.tar.bz2
lingo: don't crash sorting invoices that have no creation date (#37208)
-rw-r--r--combo/apps/lingo/models.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/combo/apps/lingo/models.py b/combo/apps/lingo/models.py
index 0619967..95e5f94 100644
--- a/combo/apps/lingo/models.py
+++ b/combo/apps/lingo/models.py
@@ -663,7 +663,8 @@ class Items(CellBase):
return ctx
ctx.update({'title': self.title, 'text': self.text})
items = self.get_invoices(user=context['user'])
- items.sort(key=lambda i: i.creation_date, reverse=True)
+ none_date = datetime.datetime(1900, 1, 1) # to avoid None-None comparison errors
+ items.sort(key=lambda i: i.creation_date or none_date, reverse=True)
ctx.update({'items': items})
return ctx