Django two-column form

django, forms, templates

Solution

I think the easiest and cleanest way is to stick to the methods outlined in the docs...

<form>
    <div class="column-1">
       {{ form.field1 }}
       ...
       {{ form.field5 }}       
    </div>
    <div class="column-2"> 
       {{ form.field6 }}
       ...
       {{ form.field9 }}
       </div>
</form>

Problem

What is the most pythonic way to implement django ModelForm for model with 9 fields, which will be split into two columns in the template? Something like this: ``` <form> <div class="column-1"> 5 fields for column 1 </div> <div class="column-2"> 4 fields for column 2 </div> </form> ```

Original source