Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#11607 closed (fixed)

ForeignKeyRawIdWidget render throws uncaught exception if value does not exist

Reported by: Joshua Russo Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords: ForeignKeyRawIdWidget widget admin render uncaught exception
Cc: pete@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The label_for_value() method will (rightfully) throw an exception saying that the record does not exist if the user types a value that doesn't exist. The clean() method will have already caught the error but because of the uncaught exception in the render you never that.

Attachments (2)

fkrawidwidget.diff (644 bytes) - added by Joshua Russo 7 years ago.
Placed a try catch around the retrieval of the label
11607.diff (2.8 KB) - added by Peter Baumgartner 7 years ago.

Download all attachments as: .zip

Change History (7)

Changed 7 years ago by Joshua Russo

Attachment: fkrawidwidget.diff added

Placed a try catch around the retrieval of the label

comment:1 Changed 7 years ago by Alex Gaynor

Triage Stage: UnreviewedAccepted

comment:2 Changed 7 years ago by Peter Baumgartner

Cc: pete@… added

Here's a patch (with test) that checks the exception being thrown.

Changed 7 years ago by Peter Baumgartner

Attachment: 11607.diff added

comment:3 Changed 7 years ago by Joshua Russo

milestone: 1.2

comment:4 Changed 7 years ago by Karen Tracey

Resolution: fixed
Status: newclosed

Fixed in r12648/r12649 for #11465. Wish I had found this ticket with test in the patch earlier.

comment:5 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

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