-
Notifications
You must be signed in to change notification settings - Fork 173
Open
Description
I am using 'extra_views' to create and update a model 'Patient' and its related model 'PatientAddress'. I am also using 'crispy_forms' to beautify the html form. CreateWithInlinesView works fine. The UpdateWithInlinesView however does not seem to play nice with crispy_forms.
I have attached the requisite files, but I give a description of the problem below:
In 'update.html', I have the following lines:
DOES NOT WORK
`{% csrf_token %}
<div class="form-row">
<div class="form-group col-md-8 mb-0">
{{ form.name|as_crispy_field }}
</div>
<div class="form-group col-md-4 mb-0">
{{ form.phone|as_crispy_field }}
</div>
</div>
{% for formset in inlines %} {% for addr in formset %}
<div class="form-row">
<div class="form-group col-md-6 mb-0">
{{ addr.line_1|as_crispy_field }}
</div>
<div class="form-group col-md-6 mb-0">
{{ addr.line_2|as_crispy_field }}
</div>
</div>
{% endfor %} {{ formset.management_form }} {% endfor %}
<div class="control-group text-right">
<div class="controls">
<button type="submit" class="btn btn-default btn-person"><i class="fas fa-save"></i> Save</button>
</div>
</div>
WORKS:
`{% csrf_token %}
<div class="form-row">
<div class="form-group col-md-8 mb-0">
{{ form.name|as_crispy_field }}
</div>
<div class="form-group col-md-4 mb-0">
{{ form.phone|as_crispy_field }}
</div>
</div>
{% for formset in inlines %} {{ formset }} {% endfor %}
<div class="control-group text-right">
<div class="controls">
<button type="submit" class="btn btn-default btn-person"><i class="fas fa-save"></i> Save</button>
</div>
</div>
The first form comes back to the update page whereas the second form works but is not at all aesthetically nice. I am not quite sure what to do with this or how to proceed from here. I apologize in advance if this is not the appropriate place to post about this.
Metadata
Metadata
Assignees
Labels
No labels