Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#14034 closed (worksforme)

admin inline formset with "extra" ignores last line when saving

Reported by: qnix Owned by: nobody
Component: Contrib apps Version: 1.2
Severity: Keywords: admin, save, inline
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I defined my inline admin model such this:

class ServiceOptionInline(admin.TabularInline):
    model = ServiceOption
    extra = 2

In the web page, I always see "extra + 1" empty inline lines to add new records. I think it's normal since there is no max_num defined. However the last line is never saved. So, there are only "extra" lines saved during the save operation. Currently, I've made a simple hack in JS that hide/delete the last row of the inline form.

Could you confirm that this is a bug and not only happens here?

Change History (2)

comment:1 Changed 8 years ago by Karen Tracey

Resolution: worksforme
Status: newclosed

I can't recreate the behavior you describe. First, with extra=2 and no max_num in an inline definition, I see 2 empty inlines to add new records, not 3, so having extra+1 empty inlines showing up indicates something off somewhere -- I do not recall ever seeing that behavior. I don't understand the comment about no max_num explaining that behavior. You may see fewer than extra empty forms, if adding the specified number extra forms would cause the total number to exceed max_num, but I don't recall any conditions where you should get more than extra empty inlines showing up.

Second, in my tests all inlines that have data entered before pressing save are in fact validated and saved.

I think there must be some additional information about your setup/configuration you have not included here that explains what is going on; so far as I can see there is not a bug in Django here.

comment:2 Changed 7 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

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