Django Admin: Customizing the inline template (tabular.html) -
I'm trying to follow the guidelines, but I stuck with a way to edit the template.
I admin.py :
Segmentformset = forms.models.inlineformset_factory (Division segment) relevant class Divijnform (forms.ModelForm) part: def __init __ (self, ** kwargs): Super (DivisionForm, self) .__ init __ (** kwargs) self.segment_formset = SegmentFormset (eg = self.instance, data = self.data, prefix = self. prefix) def Is_valid (self): return (super (Divijnform self) Kis_valid () and self Ksegment_formsetkis_valid ()) save Diarf (self Commission = true) Save: commit == true res = super (Divijnform , Self) . Save (Commit = Committee) self.segment_formset.save () returns class category Inline (admin.TabularInline): Model = Division form = DivisionForm template = "events / admin / tabular.html 'class CompetitionAdmin (VersionAdmin): inlines = [DivisionInline ,]
I template relevant part:
{% et for fieldset Inline_admin_form%} on {% line in the field =%} {% For field in% field} & lt; Td class = "{{field.field.name}}" & gt; {{Field.field.errors.as_ul}} {{field.field}} & lt; / Td> {% Endfor%} {% endfor%} & lt; Td> My section forms should be here & lt; / Td> {% Endfor%}
I do not know how to use block forms I have used with all the variable names and none of them is my division form. The division format {{fieldset.formset}} is variable and it is as long as I can.
Edit1:
Actually, the template is a bit late;) putting more code:
{% Fieldet inline_admin_form%} {% et in fieldet.formset%} {% for row in% field} & lt; Td class = "{{field.field.name}}" & gt; {{Field.field.errors.as_ul}} {{field.field}} & lt; / Td> {% Endfor%} {% endfor%} & lt; Td> My section forms should be here & lt; / Td> {% Endfor%} {% if inline_admin_formset.formset.can_delete%} & lt; Td class = "delete" & gt; {% If inline_admin_form.original%} {{inline_admin_form.deletion_field.field}} {% endif%} & lt; / TD & gt; {% Endif%} & lt; / Tr & gt; {% Endfor%} & lt; / Tbody & gt;
are similar to formatting lists, so that you
< Code> {% for formet.formset%} {{form.as_p}} {% endfor%}
Comments
Post a Comment