diff options
| author | Carl Meyer <carl@oddbird.net> | 2010-11-18 23:46:09 +0000 |
|---|---|---|
| committer | Carl Meyer <carl@oddbird.net> | 2010-11-18 23:46:09 +0000 |
| commit | d88cabd3da4bc82151ffaecc376c59478e191b20 (patch) | |
| tree | fc1f5e47dc41671237bdf2053ad9621b7ed7cddc /django/forms | |
| parent | 395af9d5cf0f68130bfd75b9bdb2c20a8c6ef51a (diff) | |
[1.2.X] Fixed #14234 -- Re-validating a model instance added via ModelForm no longer throws spurious PK uniqueness errors. Thanks to David Reynolds and Jeremy Dunck.
Also moved Model._adding to Model._state.adding to reduce instance namespace footprint.
Backport of r14612.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14615 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/models.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/forms/models.py b/django/forms/models.py index d4046a7f70..c5be8aa1e3 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -244,10 +244,10 @@ class BaseModelForm(BaseForm): # if we didn't get an instance, instantiate a new one self.instance = opts.model() object_data = {} - self.instance._adding = True + self.instance._state.adding = True else: self.instance = instance - self.instance._adding = False + 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: |
