Opened 9 years ago

Closed 9 years ago

#12348 closed (duplicate)

ForeignKeyRawIdWidget doesn't catch ObjectDoesNotExist when raw_id is illegal

Reported by: jay Owned by: nobody
Component: contrib.admin Version: 1.1
Severity: Keywords: ForeignKeyRawIdWidget
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


If a FK is referred raw_id_fields ModelAdmin, it will use ModelChoiceField with ForeignKeyRawIdWidget to render itself.

ForeignKeyRawIdWidget tests whether the value passed in the render() method is null to see if it has to call label_for_value to show the repr of the referred record. So if the value is faulty but not null, label_for_value will still be called, then ObjectDostNotExist will be thrown without any handling.

Attachments (1) (608 bytes) - added by jay 9 years ago.

Download all attachments as: .zip

Change History (2)

Changed 9 years ago by jay

Attachment: added

comment:1 Changed 9 years ago by Ramiro Morales

Resolution: duplicate
Status: newclosed

Duplicate of #11465 that has an identical patch.

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