Fix #273 -- Set correct all order expiry times to the end of the day

This commit is contained in:
Raphael Michel
2016-10-20 11:39:22 +02:00
parent bbca4e3d64
commit f22596a5a5
7 changed files with 40 additions and 16 deletions

View File

@@ -13,13 +13,14 @@ class ExtendForm(I18nModelForm):
model = Order
fields = ['expires']
widgets = {
'expires': forms.DateTimeInput(attrs={'class': 'datetimepicker'}),
'expires': forms.DateInput(attrs={'class': 'datepickerfield'}),
}
def clean(self):
data = super().clean()
if data['expires'] < now():
raise ValidationError(_('The new expiry date needs to be in the future.'))
data['expires'] = data['expires'].replace(hour=23, minute=59, second=59)
return data