mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed pk uniqueness validation for new objects created outside of a ModelForm. Also removed need for ModelForm to poke at Model._state.adding, keeping it an internal ORM concern.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14613 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -254,10 +254,8 @@ class BaseModelForm(BaseForm):
|
||||
# if we didn't get an instance, instantiate a new one
|
||||
self.instance = opts.model()
|
||||
object_data = {}
|
||||
self.instance._state.adding = True
|
||||
else:
|
||||
self.instance = instance
|
||||
self.instance._state.adding = False
|
||||
object_data = model_to_dict(instance, opts.fields, opts.exclude)
|
||||
# if initial was provided, it should override the values from instance
|
||||
if initial is not None:
|
||||
|
||||
Reference in New Issue
Block a user