Opened 16 years ago

Closed 16 years ago

#10036 closed (wontfix)

admin list_display with broken foreignkey fails

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

Description

You have a model which includes a ForeignKey field. In one of the instances of that model, that ForeignKey points to something which has disappeared for whatever reason.

If you view the object in the admin, it correctly displays that ForeignKey mapping as '----' ie null.

If you include that ForeignKey field in list_display in admin.py, django attempts to look up that relation, fails, and throws a record not found exception.

I realise that this is fundamentally a problem with referential integrity of the database - the question is, is django's handling of that a bug?

Change History (2)

comment:1 by James Bennett, 16 years ago

Personally, I think all bets are off once you let your DB lose referential integrity; if anything at all continues to work, it's most likely an accident.

comment:2 by Jacob, 16 years ago

Resolution: wontfix
Status: newclosed

Indeed; Django isn't happy with invalid references, and you shouldn't be either. A nasty error is exactly what I'd expect to see in this case.

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