check for empty duration when cleaning duration field

This commit is contained in:
Thomas Steen Rasmussen 2018-06-03 17:20:45 +02:00
parent 3fb2f44e94
commit 9c9edff4f7

View file

@ -29,7 +29,7 @@ class BaseEventProposalForm(forms.ModelForm):
def clean_duration(self):
duration = self.cleaned_data['duration']
if duration < 60 or duration > 180:
if not duration or duration < 60 or duration > 180:
raise forms.ValidationError("Please keep duration between 60 and 180 minutes.")
return duration