开发者

Django form problems

开发者 https://www.devze.com 2023-03-25 19:54 出处:网络
H开发者_StackOverflow中文版i I want to be able to display two feilds with lables on one line, for example

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消