Opened 10 years ago

Closed 9 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: UI/UX:


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@… 10 years ago.

Download all attachments as: .zip

Change History (8)

Changed 10 years ago by marcink@…

comment:1 Changed 10 years ago by Chris Beaven

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedReady for checkin

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

comment:2 Changed 10 years ago by Malcolm Tredinnick

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 Changed 9 years ago by Malcolm Tredinnick

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 Changed 9 years ago by James Bennett

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 Changed 9 years ago by jkocherhans

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 Changed 9 years ago by marcin@…

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 Changed 9 years ago by Brian Rosner

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