Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#11607 closed (fixed)

ForeignKeyRawIdWidget render throws uncaught exception if value does not exist

Reported by: Rupe 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 Rupe 6 years ago.
Placed a try catch around the retrieval of the label
11607.diff (2.8 KB) - added by baumer1122 6 years ago.

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by Rupe

Placed a try catch around the retrieval of the label

comment:1 Changed 6 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by baumer1122

  • Cc pete@… added

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

Changed 6 years ago by baumer1122

comment:3 Changed 6 years ago by Rupe

  • milestone set to 1.2

comment:4 Changed 5 years ago by kmtracey

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:5 Changed 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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