Django

Code

Ticket #12348 (closed: duplicate)

Opened 9 months ago

Last modified 9 months ago

ForeignKeyRawIdWidget doesn't catch ObjectDoesNotExist when raw_id is illegal

Reported by: jay Assigned to: nobody
Milestone: Component: django.contrib.admin
Version: 1.1 Keywords: ForeignKeyRawIdWidget
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

widgets.py.diff (0.6 kB) - added by jay on 12/10/09 02:11:24.

Change History

12/10/09 02:11:24 changed by jay

  • attachment widgets.py.diff added.

12/10/09 04:34:10 changed by ramiro

  • status changed from new to closed.
  • needs_better_patch changed.
  • resolution set to duplicate.
  • needs_tests changed.
  • needs_docs changed.

Duplicate of #11465 that has an identical patch.


Add/Change #12348 (ForeignKeyRawIdWidget doesn't catch ObjectDoesNotExist when raw_id is illegal)




Change Properties
Action