Opened 23 months ago

Closed 23 months ago

Last modified 23 months ago

#29094 closed Bug (fixed)

ForeignKeyRawIdWidget.label_and_url_for_value does not catch UUIDField ValidationError

Reported by: Carel Burger Owned by: Tim Graham
Component: contrib.admin Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

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.

Attachments (1)

29094.patch (857 bytes) - added by Carel Burger 23 months ago.

Download all attachments as: .zip

Change History (8)

Changed 23 months ago by Carel Burger

Attachment: 29094.patch added

comment:1 Changed 23 months ago by Carel Burger

Has patch: set
Needs tests: set

comment:2 Changed 23 months ago by Carel Burger

Easy pickings: set

comment:3 Changed 23 months ago by Tim Graham

Owner: changed from nobody to Tim Graham
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:4 Changed 23 months ago by Tim Graham

Needs tests: unset

comment:5 Changed 23 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 552abffa:

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.

comment:6 Changed 23 months ago by Tim Graham <timograham@…>

In 1bd45e2:

[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

comment:7 Changed 23 months ago by Tim Graham <timograham@…>

In 1c9233b1:

[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

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