summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-08-06 17:43:55 -0400
committerTim Graham <timograham@gmail.com>2015-08-07 07:44:59 -0400
commitf2b665f88610b208196b5753b09b4a5cfb322417 (patch)
treeed5cf7a32d6197e38ffabb97ded1deb456bd999c /django/forms
parent3e1bb5cfb8f9676e0c045f0d101a094437133b54 (diff)
downloaddjango-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.py2
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'