[Django] #29094: ForeignKeyRawIdWidget.label_and_url_for_value does not catch UUIDField ValidationError

5 views
Skip to first unread message

Django

unread,
Jan 31, 2018, 9:55:24 AM1/31/18
to django-...@googlegroups.com
#29094: ForeignKeyRawIdWidget.label_and_url_for_value does not catch UUIDField
ValidationError
-----------------------------------------+------------------------
Reporter: cburger | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
The `UUIDField` was recently changed where `get_db_prep_value` now calls
`to_python` which does not raise a `ValueError` but a `ValidationError`
instead.
https://github.com/django/django/commit/2f9861d823620da7ecb291a8f005f53da12b1e89

When an user enters an invalid UUID in the raw id field, the
`ValidationError` is not caught in
`ForeignKeyRawIdWidget.label_and_url_for_value` as it is expecting a
`ValueError` and not a `ValidationError`.

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

Django

unread,
Jan 31, 2018, 10:21:22 AM1/31/18
to django-...@googlegroups.com
#29094: ForeignKeyRawIdWidget.label_and_url_for_value does not catch UUIDField
ValidationError
-------------------------------+--------------------------------------
Reporter: Carel Burger | Owner: nobody

Type: Bug | Status: new
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Carel Burger):

* Attachment "29094.patch" added.

Django

unread,
Jan 31, 2018, 10:21:54 AM1/31/18
to django-...@googlegroups.com
#29094: ForeignKeyRawIdWidget.label_and_url_for_value does not catch UUIDField
ValidationError
-------------------------------+--------------------------------------
Reporter: Carel Burger | Owner: nobody

Type: Bug | Status: new
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Carel Burger):

* has_patch: 0 => 1
* needs_tests: 0 => 1


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

Django

unread,
Jan 31, 2018, 11:12:43 AM1/31/18
to django-...@googlegroups.com
#29094: ForeignKeyRawIdWidget.label_and_url_for_value does not catch UUIDField
ValidationError
-------------------------------+--------------------------------------
Reporter: Carel Burger | Owner: nobody

Type: Bug | Status: new
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0

-------------------------------+--------------------------------------
Changes (by Carel Burger):

* easy: 0 => 1


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

Django

unread,
Jan 31, 2018, 1:25:46 PM1/31/18
to django-...@googlegroups.com
#29094: ForeignKeyRawIdWidget.label_and_url_for_value does not catch UUIDField
ValidationError
-------------------------------+--------------------------------------
Reporter: Carel Burger | Owner: Tim Graham
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Tim Graham):

* owner: nobody => Tim Graham
* status: new => assigned
* stage: Unreviewed => Accepted


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

Django

unread,
Jan 31, 2018, 1:52:44 PM1/31/18
to django-...@googlegroups.com
#29094: ForeignKeyRawIdWidget.label_and_url_for_value does not catch UUIDField
ValidationError
-------------------------------+--------------------------------------
Reporter: Carel Burger | Owner: Tim Graham
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.11

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* needs_tests: 1 => 0


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/29094#comment:4>

Django

unread,
Feb 1, 2018, 8:56:36 AM2/1/18
to django-...@googlegroups.com
#29094: ForeignKeyRawIdWidget.label_and_url_for_value does not catch UUIDField
ValidationError
-------------------------------+--------------------------------------
Reporter: Carel Burger | Owner: Tim Graham
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

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


Comment:

In [changeset:"552abffab16cbdff571486b683e7e7ef12e46066" 552abffa]:
{{{
#!CommitTicketReference repository=""
revision="552abffab16cbdff571486b683e7e7ef12e46066"
Fixed #29094 -- Fixed crash when entering an invalid uuid in
ModelAdmin.raw_id_fields.

Regression in 2f9861d823620da7ecb291a8f005f53da12b1e89.

Thanks Carel Burger for the report and fix.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29094#comment:5>

Django

unread,
Feb 1, 2018, 8:56:53 AM2/1/18
to django-...@googlegroups.com
#29094: ForeignKeyRawIdWidget.label_and_url_for_value does not catch UUIDField
ValidationError
-------------------------------+--------------------------------------
Reporter: Carel Burger | Owner: Tim Graham
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.11

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

Comment (by Tim Graham <timograham@…>):

In [changeset:"1bd45e24584286075f4ff6cbeff2437c77e2c762" 1bd45e2]:
{{{
#!CommitTicketReference repository=""
revision="1bd45e24584286075f4ff6cbeff2437c77e2c762"
[2.0.x] Fixed #29094 -- Fixed crash when entering an invalid uuid in
ModelAdmin.raw_id_fields.

Regression in 2f9861d823620da7ecb291a8f005f53da12b1e89.

Thanks Carel Burger for the report and fix.

Backport of 552abffab16cbdff571486b683e7e7ef12e46066 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29094#comment:6>

Django

unread,
Feb 1, 2018, 9:05:18 AM2/1/18
to django-...@googlegroups.com
#29094: ForeignKeyRawIdWidget.label_and_url_for_value does not catch UUIDField
ValidationError
-------------------------------+--------------------------------------
Reporter: Carel Burger | Owner: Tim Graham
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.11

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

Comment (by Tim Graham <timograham@…>):

In [changeset:"1c9233b1b9f903e4e2cb20a724e8c22aee4aacb2" 1c9233b1]:
{{{
#!CommitTicketReference repository=""
revision="1c9233b1b9f903e4e2cb20a724e8c22aee4aacb2"
[1.11.x] Fixed #29094 -- Fixed crash when entering an invalid uuid in
ModelAdmin.raw_id_fields.

Regression in 2f9861d823620da7ecb291a8f005f53da12b1e89.

Thanks Carel Burger for the report and fix.

Backport of docs552abffab16cbdff571486b683e7e7ef12e46066 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29094#comment:7>

Reply all
Reply to author
Forward
0 new messages