Fix #6341 - BaseUniqueForValidator uses instance

Prevents partial updates to serializes with
UniqueFor[Date,Month,Year]Validators from failing unnecessarily.
This commit is contained in:
Andrew Pinkham 2018-12-22 14:24:41 +01:00
parent 49984b06dc
commit 5ac5784c62
No known key found for this signature in database
GPG Key ID: FACEF94E02416ACA

View File

@ -204,6 +204,9 @@ class BaseUniqueForValidator(object):
The `UniqueFor<Range>Validator` classes always force an implied
'required' state on the fields they are applied to.
"""
if hasattr(self, "instance") and self.instance is not None:
return
missing_items = {
field_name: self.missing_message
for field_name in [self.field, self.date_field]