diff --git a/event/models.py b/event/models.py index cd96040..7560ae1 100644 --- a/event/models.py +++ b/event/models.py @@ -1,22 +1,15 @@ from django.contrib.auth import get_user_model -from django.core.validators import RegexValidator from django.core.exceptions import FieldDoesNotExist, FieldError from django.db import models from django.utils.translation import ugettext_lazy as _ from communication.models import SubscriptionMixin +from .validators import ColorValidator + User = get_user_model() -ColorValidator = RegexValidator( - regex=r'^#(?:[0-9a-fA-F]{3}){1,2}$', - message=_( - "La chaîne de caractère rentrée n'est pas une couleur en hexadécimal." - ), -) - - class Event(SubscriptionMixin, models.Model): title = models.CharField( _("nom de l'évènement"), diff --git a/event/tests.py b/event/tests.py index 36dee90..29c840f 100644 --- a/event/tests.py +++ b/event/tests.py @@ -97,14 +97,14 @@ class ActivityInheritanceTest(TestCase): self.assertEqual(self.real_act.get_herited('max_perm'), 1) def test_inherits_place(self): - self.template_act.place.add(self.loge) + self.template_act.places.add(self.loge) self.assertEqual( - self.real_act.get_herited('place').get(), + self.real_act.get_herited('places').get(), self.loge ) - self.real_act.place.add(self.aqua) + self.real_act.places.add(self.aqua) self.assertEqual( - self.real_act.get_herited('place').get(), + self.real_act.get_herited('places').get(), self.aqua )