Opened 17 years ago

Closed 16 years ago

#3434 closed (invalid)

[newforms-admin] change_stage is broken for models with no editable fields

Reported by: marcink@… Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

render_change_form raises an IndexError (list index out of range)
for models that have no editable fields. This may sound weird, but
it actually makes sense in some situations, ie. for a model that
serves only as a foreignkey target with edit_inline.

I only tested this for the old admin, but from the source code
it appears that the newforms one has the same problem. The patch
is for old admin, but fixing newforms-admin is just as simple.

Attachments (1)

patch_admin_for_empty_models.patch (922 bytes ) - added by marcink@… 17 years ago.

Download all attachments as: .zip

Change History (8)

by marcink@…, 17 years ago

comment:1 by Chris Beaven, 17 years ago

Triage Stage: UnreviewedReady for checkin

Sort of a fringe case, but it's an easy fix.

comment:2 by Malcolm Tredinnick, 17 years ago

Summary: [patch] change_stage is broken for models with no editable fields[newforms-admin] change_stage is broken for models with no editable fields

Not worth fixing on trunk, since we are close to moving away from existing admin entirely. Applicable to newforms-admin, though.

comment:3 by Malcolm Tredinnick, 17 years ago

Has patch: set
Triage Stage: Ready for checkinAccepted

I'm going to hold off on committing this yet until we see how edit_inline functionality pans out in newforms-admin. It might need changing or it might not be a necessary fix at all (the only use-case I can think of is the one mentioned in the ticket summary).

comment:4 by James Bennett, 17 years ago

Owner: changed from nobody to jkocherhans
Version: SVNnewforms-admin

Reassigning to jkocherhans so he can figure out what needs to be done here.

comment:5 by jkocherhans, 16 years ago

Owner: changed from jkocherhans to nobody

Assigning to nobody. I'm not working on this right now, or probably any time soon either. edit_inline is still going to see some big changes.

comment:6 by marcin@…, 16 years ago

Note: this patch is no longer valid for newforms-admin. The problem is still present in the branch, but now has much less of an impact: you will get javascript error instead of Python exception.

comment:7 by Brian Rosner, 16 years ago

Resolution: invalid
Status: newclosed

Yeah, edit_inline stuff should now not be prone to this any longer. Closing this ticket since you explicitly tell the ModelAdmin what inlines to use. If you make an inline with no editable fields then that is a developer problem.

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