Reflect changes on validators/fields

This commit is contained in:
Aurélien Delobelle 2017-08-03 12:14:15 +02:00
parent cd78757244
commit 07d4c3ead1
2 changed files with 6 additions and 13 deletions

View file

@ -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"),

View file

@ -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
)