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

Download all attachments as: .zip

Change History (8)

Changed 9 years ago by marcink@…

comment:1 Changed 9 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

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

comment:2 Changed 9 years ago by mtredinnick

  • Summary changed from [patch] change_stage is broken for models with no editable fields to [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 mtredinnick

  • Has patch set
  • Triage Stage changed from Ready for checkin to Accepted

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 ubernostrum

  • Owner changed from nobody to jkocherhans
  • Version changed from SVN to newforms-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 brosner

  • Resolution set to invalid
  • Status changed from new to closed

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