diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2014-05-08 19:49:59 -0700 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2014-05-08 19:49:59 -0700 |
| commit | d2e96b5792367af5aa0140f7e2673d654bb266df (patch) | |
| tree | 987df9903290e381b248e72b4fb60ad452c47789 /django | |
| parent | 7194d40236fc9f848f6efd313c1636ba1aceb700 (diff) | |
| parent | 724a7bf222e31f42e2ab431cc09da224081d03fa (diff) | |
Merge pull request #2637 from davidszotten/validator_comparisons
[1.7.x] Fixed #22588 -- Fix RegexValidator __eq__
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/validators.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/django/core/validators.py b/django/core/validators.py index cc71b72a6a..da59c0e924 100644 --- a/django/core/validators.py +++ b/django/core/validators.py @@ -51,7 +51,17 @@ class RegexValidator(object): raise ValidationError(self.message, code=self.code) def __eq__(self, other): - return isinstance(other, RegexValidator) and (self.regex == other.regex) and (self.message == other.message) and (self.code == other.code) + return ( + isinstance(other, RegexValidator) and + self.regex.pattern == other.regex.pattern and + self.regex.flags == other.regex.flags and + (self.message == other.message) and + (self.code == other.code) and + (self.inverse_match == other.inverse_match) + ) + + def __ne__(self, other): + return not (self == other) @deconstructible |
