From 07d4c3ead1439cce2f51a8e4b42b60dfbd3e44fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Thu, 3 Aug 2017 12:14:15 +0200 Subject: [PATCH] Reflect changes on validators/fields --- event/models.py | 11 ++--------- event/tests.py | 8 ++++---- 2 files changed, 6 insertions(+), 13 deletions(-) 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 )