Ticket #18376: unique_ignore_blank_fields.diff
File unique_ignore_blank_fields.diff, 632 bytes (added by , 12 years ago) |
---|
-
django/db/models/base.py
diff --git a/django/db/models/base.py b/django/db/models/base.py index a1f9e2f..918faf6 100644
a b class Model(six.with_metaclass(ModelBase, object)): 777 777 for field_name in unique_check: 778 778 f = self._meta.get_field(field_name) 779 779 lookup_value = getattr(self, f.attname) 780 if lookup_value is None :780 if lookup_value is None or lookup_value == '': 781 781 # no value, skip the lookup 782 782 continue 783 783 if f.primary_key and not self._state.adding: