mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
CHANGE: Prevent both person and org being left blank for a Rig
Of course, there's no requirement that either of those have any actual contact details... Closes #276.
This commit is contained in:
@@ -129,6 +129,11 @@ class EventForm(forms.ModelForm):
|
|||||||
|
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
if self.cleaned_data.get("is_rig") and not (self.cleaned_data.get('person') or self.cleaned_data.get('organisation')):
|
||||||
|
raise forms.ValidationError('You haven\'t provided any client contact details. Please add a person or organisation.', code='contact')
|
||||||
|
return super(EventForm, self).clean()
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
m = super(EventForm, self).save(commit=False)
|
m = super(EventForm, self).save(commit=False)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user