summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorKaren Tracey <kmtracey@gmail.com>2008-11-05 19:47:44 +0000
committerKaren Tracey <kmtracey@gmail.com>2008-11-05 19:47:44 +0000
commit21fa51724822b4aa89bc1e110c2ce9b8477f9e64 (patch)
tree174de686bc62dd5cc7c140c42ee4ebfb10d46f91 /django
parente600364f7ddc77c45339bee5527f2e3898e7b126 (diff)
Fixed #9218 -- Simplified the fix from #9039 and added tests to ensure this case doesn't break again (and that the simplification didn't break anything).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9341 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/forms/models.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index cd2191307e..299991e509 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -234,7 +234,7 @@ class BaseModelForm(BaseForm):
# equal NULL in SQL we should not do any unique checking for NULL values.
unique_checks = []
for check in self.instance._meta.unique_together[:]:
- fields_on_form = [field for field in check if field in self.cleaned_data and not self.cleaned_data[field] is None]
+ fields_on_form = [field for field in check if self.cleaned_data.get(field) is not None]
if len(fields_on_form) == len(check):
unique_checks.append(check)
@@ -248,7 +248,7 @@ class BaseModelForm(BaseForm):
except FieldDoesNotExist:
# This is an extra field that's not on the ModelForm, ignore it
continue
- if f.unique and name in self.cleaned_data and not self.cleaned_data[name] is None:
+ if f.unique and self.cleaned_data.get(name) is not None:
unique_checks.append((name,))
bad_fields = set()