Opened 7 years ago

Last modified 6 years ago

#29431 closed Cleanup/optimization

inline_admin should have possibility don't generate empty inline form. — at Version 1

Reported by: Maxim Danilov Owned by: nobody
Component: contrib.admin Version:
Severity: Normal Keywords: InlineFormSet, optimization
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Maxim Danilov)

for example in admin.py:

class my_model_inline(admin.StackedInline):
	can_add_empty = False
stacked.html after {% for inline_admin_form in inline_admin_formset %} : 
{% if opts.can_add_empty or not forloop.last %} - this helped don't call a formset.empty_form, if i dont need it.

but it is better check it already in: InlineAdminFormSet.iter(self), last iteration.
I think, it makes django better and give more speed.

Change History (1)

comment:1 by Maxim Danilov, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top