I came across a question while working with django-crispy-forms for which I'm unable to get an answer. I have a rather complex form layout, everything works extremly nice with cripy-forms so far.
One part of the form uses a generic inline formset. This is working as well, but my problem is, that i cannot figure out how to access the delete-checkbox (when having can_delete=True)
The corresponding code looks something like:
class BaseReleaseReleationFormSet(BaseGenericInlineFormSet):
def __init__(self, *args, **kwargs):
self.instance = kwargs['instance']
super(BaseReleaseReleationFormSet, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_id = "id_relation_form"
self.helper.form_class = 'form-horizontal'
self.helper.form_method = 'post'
self.helper.form_action = ''
self.helper.form_tag = False
base_layout = Row(
Column(
Field('name', css_class='input-small'),
#Field('delete', css_class='input-small'),
css_class='span3'
),
Column(
Field('url', css_class='input-xlarge'),
css_class='span4'
),
css_class='row relation-row',
)
self.helper.add_layout(base_layout)
The name and url field are rendered with crispy-forms as desired, but the delete-checkbox appears at the end of the form. And I'm unable to access it in the layout.
Does someone know how to address this problem? Any tips? Thanks in advance!