Ticket #13683: django-13683.diff

File django-13683.diff, 953 bytes (added by dalorin, 14 years ago)

Changes InlineAdminFormSet to check max_num != 0 before constructing empty form

  • django/contrib/admin/helpers.py

     
    208208            yield InlineAdminForm(self.formset, form, self.fieldsets,
    209209                self.opts.prepopulated_fields, None, self.readonly_fields,
    210210                model_admin=self.model_admin)
    211         yield InlineAdminForm(self.formset, self.formset.empty_form,
    212             self.fieldsets, self.opts.prepopulated_fields, None,
    213             self.readonly_fields, model_admin=self.model_admin)
     211        if self.formset.max_num != 0:
     212            yield InlineAdminForm(self.formset, self.formset.empty_form,
     213                self.fieldsets, self.opts.prepopulated_fields, None,
     214                self.readonly_fields, model_admin=self.model_admin)
    214215
    215216    def fields(self):
    216217        fk = getattr(self.formset, "fk", None)
Back to Top