Ticket #9218: key-error-on-empty-pk-field-in-forms-fix.patch
File key-error-on-empty-pk-field-in-forms-fix.patch, 660 bytes (added by , 16 years ago) |
---|
-
forms/models.py
232 232 continue 233 233 # MySQL can't handle ... WHERE pk IS NULL, so make sure we 234 234 # don't generate queries of that form. 235 is_null_pk = f.primary_key and self.cleaned_data [name] is None235 is_null_pk = f.primary_key and self.cleaned_data.has_key(name) and self.cleaned_data[name] is None 236 236 if name in self.cleaned_data and f.unique and not is_null_pk: 237 237 unique_checks.append((name,)) 238 238