diff --git a/helpdesk/forms.py b/helpdesk/forms.py index b766ceb6..75367e19 100644 --- a/helpdesk/forms.py +++ b/helpdesk/forms.py @@ -540,6 +540,16 @@ class TicketCCForm(forms.ModelForm): model = TicketCC 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 Meta: model = TicketDependency