Make validator not trigger migration creation.

This commit is contained in:
Roberto Rosario
2015-07-11 02:59:18 -04:00
parent f95c9c2aa4
commit 72bbc3f4e9
3 changed files with 31 additions and 6 deletions
+9 -1
View File
@@ -3,8 +3,8 @@ from __future__ import unicode_literals
import yaml
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.deconstruct import deconstructible
from django.utils.translation import ugettext_lazy as _
@deconstructible
@@ -19,3 +19,11 @@ class YAMLValidator(object):
yaml.safe_load(value)
except yaml.error.YAMLError:
raise ValidationError(_('Enter a valid YAML value.'), code='invalid')
def __eq__(self, other):
return (
isinstance(other, YAMLValidator)
)
def __ne__(self, other):
return not (self == other)