[Django] #25241: ModelForm.save() gives wrong message when saving invalid form with UUIDField pk

11 views
Skip to first unread message

Django

unread,
Aug 6, 2015, 5:43:54 PM8/6/15
to django-...@googlegroups.com
#25241: ModelForm.save() gives wrong message when saving invalid form with
UUIDField pk
-------------------------------------+---------------------------
Reporter: timgraham | Owner: timgraham
Type: Bug | Status: new
Component: Forms | Version: master
Severity: Normal | Keywords:
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+---------------------------
self.

`save()`
[https://github.com/django/django/blob/3e1bb5cfb8f9676e0c045f0d101a094437133b54/django/forms/models.py#L457
checks] `self.instance.pk is None` which is the incorrect condition in the
case of a model with a `UUIDField` primary key.

--
Ticket URL: <https://code.djangoproject.com/ticket/25241>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 6, 2015, 6:40:25 PM8/6/15
to django-...@googlegroups.com
#25241: ModelForm.save() gives wrong message when saving invalid form with
UUIDField pk
---------------------------+-------------------------------------

Reporter: timgraham | Owner: timgraham
Type: Bug | Status: new
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------+-------------------------------------
Changes (by timgraham):

* has_patch: 0 => 1


Old description:

> self.
>
> `save()`
> [https://github.com/django/django/blob/3e1bb5cfb8f9676e0c045f0d101a094437133b54/django/forms/models.py#L457
> checks] `self.instance.pk is None` which is the incorrect condition in
> the case of a model with a `UUIDField` primary key.

New description:

`save()`
[https://github.com/django/django/blob/3e1bb5cfb8f9676e0c045f0d101a094437133b54/django/forms/models.py#L457
checks] `self.instance.pk is None` which is the incorrect condition in the
case of a model with a `UUIDField` primary key.

--

Comment:

[https://github.com/django/django/pull/5111 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/25241#comment:1>

Django

unread,
Aug 6, 2015, 7:03:28 PM8/6/15
to django-...@googlegroups.com
#25241: ModelForm.save() gives wrong message when saving invalid form with
UUIDField pk
---------------------------+-------------------------------------

Reporter: timgraham | Owner: timgraham
Type: Bug | Status: new
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------+-------------------------------------

Comment (by candeira):

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/25241#comment:2>

Django

unread,
Aug 7, 2015, 8:51:55 AM8/7/15
to django-...@googlegroups.com
#25241: ModelForm.save() gives wrong message when saving invalid form with
UUIDField pk
---------------------------+-------------------------------------
Reporter: timgraham | Owner: timgraham
Type: Bug | Status: closed
Component: Forms | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"f2b665f88610b208196b5753b09b4a5cfb322417" f2b665f8]:
{{{
#!CommitTicketReference repository=""
revision="f2b665f88610b208196b5753b09b4a5cfb322417"
Fixed #25241 -- Corrected ModelForm.save() error message when saving
invalid form with UUIDField pk.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25241#comment:3>

Reply all
Reply to author
Forward
0 new messages