Code

Opened 5 years ago

Closed 4 years ago

Last modified 3 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 5 years ago.
Placed a try catch around the retrieval of the label
11607.diff (2.8 KB) - added by baumer1122 5 years ago.

Download all attachments as: .zip

Change History (7)

Changed 5 years ago by Rupe

Placed a try catch around the retrieval of the label

comment:1 Changed 5 years ago by Alex

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

comment:2 Changed 5 years ago by baumer1122

  • Cc pete@… added

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

Changed 5 years ago by baumer1122

comment:3 Changed 5 years ago by Rupe

  • milestone set to 1.2

comment:4 Changed 4 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 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.