Avoid triggering migration creation using functions for choices and validators choices.

This commit is contained in:
Roberto Rosario
2015-07-07 21:21:08 -04:00
parent 7a11fddcc1
commit 0e81ea2ab8
5 changed files with 78 additions and 2 deletions
+5 -1
View File
@@ -16,6 +16,10 @@ from .validators import YAMLValidator
logger = logging.getLogger(__name__)
def validators():
return [YAMLValidator()]
@python_2_unicode_compatible
class Transformation(models.Model):
"""
@@ -29,7 +33,7 @@ class Transformation(models.Model):
order = models.PositiveIntegerField(blank=True, db_index=True, default=0, help_text=_('Order in which the transformations will be executed.'), null=True, verbose_name=_('Order'))
name = models.CharField(choices=BaseTransformation.get_transformation_choices(), max_length=128, verbose_name=_('Name'))
arguments = models.TextField(blank=True, help_text=_('Enter the arguments for the transformation as a YAML dictionary. ie: {"degrees": 180}'), validators=[YAMLValidator()], verbose_name=_('Arguments'))
arguments = models.TextField(blank=True, help_text=_('Enter the arguments for the transformation as a YAML dictionary. ie: {"degrees": 180}'), validators=validators, verbose_name=_('Arguments'))
objects = TransformationManager()