Code

Opened 7 years ago

Closed 6 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:

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

Download all attachments as: .zip

Change History (8)

Changed 7 years ago by marcink@…

comment:1 Changed 7 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 7 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 7 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 7 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 6 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 6 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 6 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.