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:17:05 (GMT)
commit09c890d0ff93ea647350f9e314618723a69af2dc (patch)
treeaaba153b68b567faa61224e85884b3f23601c5a5
parentead5a5b9cd77279f2a4923c3f3422ac47689a7d1 (diff)
downloadcombo-09c890d0ff93ea647350f9e314618723a69af2dc.zip
combo-09c890d0ff93ea647350f9e314618723a69af2dc.tar.gz
combo-09c890d0ff93ea647350f9e314618723a69af2dc.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