H开发者_StackOverflow中文版i I want to be able to display two feilds with lables on one line, for example
<table>
<tr>
<td>Field1lable</td><td>Field1field</td>
<td>field2lable</td><td>field2field</td>
</tr>
</table>
I have my form using a loop, I don't want to add the feilds in manually, as if I add to the form in the future I want this to update automatically on all pages. Has anyone got any ideas on how this can be done using django. all comments welcome
i think you're looking for https://docs.djangoproject.com/en/dev/topics/forms/#displaying-a-form-using-a-template in the specific the "as_table" option. with form.as_table in your template you'll have exactly the output you're asking for
since you talked about "adding fields manually", did you read first of all the basic django forms page?
精彩评论