mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2025-01-15 10:28:37 +01:00
ADDED: <TicketCCForm.clean> to validate if either a valid user or a valid email is provided when saving <TicketCC> instances
This commit is contained in:
parent
99bfc340f9
commit
e4337cef1d
@ -540,6 +540,16 @@ class TicketCCForm(forms.ModelForm):
|
|||||||
model = TicketCC
|
model = TicketCC
|
||||||
exclude = ('ticket',)
|
exclude = ('ticket',)
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
|
||||||
|
cleaned_data = super(TicketCCForm, self).clean()
|
||||||
|
|
||||||
|
user = cleaned_data.get('user', None)
|
||||||
|
email = cleaned_data.get('email', '')
|
||||||
|
|
||||||
|
if user is None and len(email) == 0:
|
||||||
|
raise forms.ValidationError(_('When you add somebody on Cc, you must provided either an User or a valid email.'))
|
||||||
|
|
||||||
class TicketDependencyForm(forms.ModelForm):
|
class TicketDependencyForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = TicketDependency
|
model = TicketDependency
|
||||||
|
Loading…
Reference in New Issue
Block a user