Skip to content

Commit 217b31f

Browse files
committed
Made the RegexStringValidator deconstructible so we can generate migrations.
- Legacy-Id: 12476
1 parent 7fbf2e8 commit 217b31f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

ietf/utils/validators.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
import re
66

77
from django.core.exceptions import ValidationError
8+
from django.utils.deconstruct import deconstructible
89

9-
10+
@deconstructible
1011
class RegexStringValidator(object):
1112

12-
def __init__(self,):
13+
def __init__(self):
1314
pass
1415

1516
def __call__(self, value):
@@ -28,5 +29,10 @@ def __call__(self, value):
2829
'Maybe you meant to write "-.*"? If you actually meant "-*", '
2930
'you can use "[-]*" instead to get past this error.')
3031

32+
def __eq__(self, other):
33+
return isinstance(other, RegexStringValidator)
34+
35+
def __ne__(self, other):
36+
return not (self == other)
3137

3238
validate_regular_expression_string = RegexStringValidator()

0 commit comments

Comments
 (0)