Opened 8 years ago

Closed 8 years ago

#13506 closed (wontfix)

admin does not allow saving of blank inline objects

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


If I have an inline that allows all fields to be blank, it is impossible to create a new object with all blank fields. I have to add some text to one of the fields, save it, then remove it, and re-save to create a new, blank object.

I only noticed this after setting extra = 0 on the TabularInline and then clicking the "Add another" button. This dynamically adds another row with the object as expected, but when I save, the row is not saved because it's blank. The admin seems to be treating this row the same way it treats the default empty rows.

I don't know if this is a deliberate design decision (there are some use cases for "empty" objects, but you can create them outside of the inline if you absolutely have to), or if it's simply a UI issue. One solution might be to add some kind of widget in the delete column that provides the opposite function - a "create" toggle that turns green when any fields are modified or it is clicked.

In any case, as the UI currently stands, clicking "add another" and then not getting another object saved is confusing and counter-intuitive.

Change History (1)

comment:1 Changed 8 years ago by Russell Keith-Magee

Resolution: wontfix
Status: newclosed

I'm inclined to call this a deliberate design decision. The "Add another" button is a recent manifestation of this, but Django has always used empty inlines forms as blanks, not empty (but existent) records - case in point; disable javascript and set extra=3 (or downgrade to Django 1.1)

This is an edge case that I think should be handled at the user level; if you use a custom form for your inline, and add a checkbox that will overcome the 'has this row got any data in it' condition, that should be sufficient to enable the population of empty inline rows.

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