Opened 9 years ago

Closed 9 years ago

#25241 closed Bug (fixed)

ModelForm.save() gives wrong message when saving invalid form with UUIDField pk

Reported by: Tim Graham Owned by: Tim Graham
Component: Forms Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

save() checks self.instance.pk is None which is the incorrect condition in the case of a model with a UUIDField primary key.

Change History (3)

comment:1 by Tim Graham, 9 years ago

Description: modified (diff)
Has patch: set

comment:2 by Javier Candeira, 9 years ago

Thanks for this. You're cleaning here a lot of of cruft that I left in my own #25227 because I didn't know whether it was used from other parts of Django.

I assume this is as good as merged. I'll rebase my patch on your one before continuing with the #25227 discussion.

comment:3 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In f2b665f8:

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

Note: See TracTickets for help on using tickets.
Back to Top