misc: allow sorting forms without receipt time (#40157)

This commit is contained in:
Frédéric Péters 2020-02-25 09:41:50 +01:00
parent 6339129fdf
commit 4dd829ebee
1 changed files with 2 additions and 1 deletions

View File

@ -1413,7 +1413,8 @@ class RootDirectory(AccessControlled, Directory):
for formdef in all_formdefs:
user_forms.extend(get_user_forms(formdef))
user_forms = [x for x in user_forms if x.formdef.is_user_allowed_read(user, x)]
user_forms.sort(key=lambda x: (x.receipt_time,))
epoch = time.localtime(1970)
user_forms.sort(key=lambda x: x.receipt_time or epoch)
if self.category:
r += self.form_list(list_forms, category = self.category,