X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/e06925fc9be46b2c07863440212600b2e7ecb597..4124d776c70ea5a7cf8bd08223f61bc1c73af348:/models/base.py?ds=inline diff --git a/models/base.py b/models/base.py index 27c45dc..ceeb81e 100644 --- a/models/base.py +++ b/models/base.py @@ -6,12 +6,13 @@ from django.core.exceptions import ObjectDoesNotExist from philo.exceptions import AncestorDoesNotExist from philo.utils import ContentTypeRegistryLimiter from philo.signals import entity_class_prepared +from philo.validators import json_validator from UserDict import DictMixin class Tag(models.Model): - name = models.CharField(max_length=250) - slug = models.SlugField(unique=True) + name = models.CharField(max_length=255) + slug = models.SlugField(max_length=255, unique=True) def __unicode__(self): return self.name @@ -36,7 +37,7 @@ class Attribute(models.Model): entity_object_id = models.PositiveIntegerField(verbose_name='Entity ID') entity = generic.GenericForeignKey('entity_content_type', 'entity_object_id') key = models.CharField(max_length=255) - json_value = models.TextField(verbose_name='Value (JSON)', help_text='This value must be valid JSON.') + json_value = models.TextField(verbose_name='Value (JSON)', help_text='This value must be valid JSON.', validators=[json_validator]) def get_value(self): return json.loads(self.json_value)