How can one insert markup between subsets of form fields in django, while staying DRY?
Given:
class CompensationUpdate(UpdateView):
model = Compensation
fields = [
'salary1',
'salary2',
'incentive1',
'incentive2', ]
I'd like to be able to access them in the view in such a way that I can wrap groups of them in markup. For example:
<div class="ibox-content">
{% for field in form.salary_fields %}
...
{% endfor %}
</div>
<div class="ibox-content">
{% for field in form.incentive_fields %}
...
{% endfor %}
</div>
I have over 50 fields on the form in about 10 groups, so I need to do this in a DRY manner. While I can access each field individually, I can't figure out how to define subsets (either in the UpdateView or directly in the template).