mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-26 06:32:26 +00:00
For my klafy : return best mandate possible
This commit is contained in:
parent
21f95fbc9d
commit
b38521db69
1 changed files with 1 additions and 1 deletions
|
@ -531,7 +531,7 @@ class Mandate(RevMixin, AclMixin, models.Model):
|
||||||
""""Find the mandate taking place at the given date."""
|
""""Find the mandate taking place at the given date."""
|
||||||
if callable(date):
|
if callable(date):
|
||||||
date = date()
|
date = date()
|
||||||
mandate = cls.objects.filter(start_date__lte=date).order_by('-start_date').first()
|
mandate = cls.objects.exclude(end_date__lte=date).order_by('start_date').first() or cls.objects.order_by('start_date').last()
|
||||||
if not mandate:
|
if not mandate:
|
||||||
raise cls.DoesNotExist("No mandate have been created. Please go to the preferences page to create one.")
|
raise cls.DoesNotExist("No mandate have been created. Please go to the preferences page to create one.")
|
||||||
return mandate
|
return mandate
|
||||||
|
|
Loading…
Reference in a new issue