diff options
| author | Tim Graham <timograham@gmail.com> | 2015-08-06 17:43:55 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-08-07 07:44:59 -0400 |
| commit | f2b665f88610b208196b5753b09b4a5cfb322417 (patch) | |
| tree | ed5cf7a32d6197e38ffabb97ded1deb456bd999c /django/forms | |
| parent | 3e1bb5cfb8f9676e0c045f0d101a094437133b54 (diff) | |
| download | django-f2b665f88610b208196b5753b09b4a5cfb322417.tar.gz | |
Fixed #25241 -- Corrected ModelForm.save() error message when saving invalid form with UUIDField pk.
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/models.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/forms/models.py b/django/forms/models.py index 31e4bbaa66..7592c09787 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -454,7 +454,7 @@ class BaseModelForm(BaseForm): If commit=True, then the changes to ``instance`` will be saved to the database. Returns ``instance``. """ - if self.instance.pk is None: + if self.instance._state.adding: fail_message = 'created' else: fail_message = 'changed' |
