1👍
Not quite sure what / where I went wrong but this works:
forms.py:
class EntryForm(forms.ModelForm):
class Meta:
model = Entry
fields = ['row_control', 'date', 'hours']
def clean(self):
cleaned_data = self.cleaned_data
if cleaned_data['hours'] <= 0:
raise forms.ValidationError("Hours worked must be more than 0.")
# Always return cleaned data
return cleaned_data
Source:stackexchange.com