mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-01-07 06:28:52 +01:00
Add a clean method on TicketCC model in order to be sure not to add a user who doesn't have an email address.
This commit is contained in:
parent
79d8046694
commit
7564c5739b
@ -10,7 +10,7 @@ models.py - Model (and hence database) definitions. This is the core of the
|
||||
from django.contrib.auth.models import Permission
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.exceptions import ObjectDoesNotExist, ValidationError
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
@ -1666,6 +1666,10 @@ class TicketCC(models.Model):
|
||||
def __str__(self):
|
||||
return '%s for %s' % (self.display, self.ticket.title)
|
||||
|
||||
def clean(self):
|
||||
if self.user and not self.user.email:
|
||||
raise ValidationError('User has no email address')
|
||||
|
||||
|
||||
class CustomFieldManager(models.Manager):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user