1
0
mirror of https://github.com/django/django.git synced 2025-10-26 15:16:09 +00:00

Fixed #25241 -- Corrected ModelForm.save() error message when saving invalid form with UUIDField pk.

This commit is contained in:
Tim Graham
2015-08-06 17:43:55 -04:00
parent 3e1bb5cfb8
commit f2b665f886
4 changed files with 37 additions and 2 deletions

View File

@@ -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'