Opened 15 years ago

Closed 15 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

Description

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)

widgets.py.diff (608 bytes ) - added by jay 15 years ago.

Download all attachments as: .zip

Change History (2)

by jay, 15 years ago

Attachment: widgets.py.diff added

comment:1 by Ramiro Morales, 15 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #11465 that has an identical patch.

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