Made serialization work for RegexStringValidator

- Legacy-Id: 12492
This commit is contained in:
Henrik Levkowetz 2016-12-09 12:40:21 +00:00
parent 57eb5844e5
commit 2978798f39

View file

@ -5,11 +5,12 @@ from __future__ import unicode_literals
import re
from django.core.exceptions import ValidationError
from django.utils.deconstruct import deconstructible
@deconstructible
class RegexStringValidator(object):
def __init__(self,):
def __init__(self):
pass
def __call__(self, value):
@ -28,5 +29,10 @@ class RegexStringValidator(object):
'Maybe you meant to write "-.*"? If you actually meant "-*", '
'you can use "[-]*" instead to get past this error.')
def __eq__(self, other):
return isinstance(other, RegexStringValidator)
def __ne__(self, other):
return not (self == other)
validate_regular_expression_string = RegexStringValidator()