Small news improvement and bug fixes

This commit is contained in:
Skia
2017-04-12 21:08:51 +02:00
parent 44dacce9f2
commit 6a815e5a21
4 changed files with 7 additions and 12 deletions

View File

@ -107,6 +107,8 @@ class NewsForm(forms.ModelForm):
self.add_error('start_date', ValidationError(_("This field is required.")))
if not self.cleaned_data['end_date']:
self.add_error('end_date', ValidationError(_("This field is required.")))
if self.cleaned_data['start_date'] > self.cleaned_data['end_date']:
self.add_error('end_date', ValidationError(_("You crazy? You can not finish an event before starting it.")))
if self.cleaned_data['type'] == "WEEKLY" and not self.cleaned_data['until']:
self.add_error('until', ValidationError(_("This field is required.")))
return self.cleaned_data