我正在从表单创建一个表:
<form method="post" action=".">{% csrf_token %}
{{ form.as_table }}
<input type="submit" value="register" />
</form>
在我的forms.py
我有
class RegistrationForm(forms.Form):
username = forms.CharField(label=u'Username', max_length=30)
first_name = forms.CharField(label=u'First Name', max_length=30)
last_name = forms.CharField(label=u'Last Name', max_length=30)
email = forms.EmailField(label=u'Email')
password1 = forms.CharField(
label=u'Password',
widget=forms.PasswordInput()
)
password2 = forms.CharField(
label=u'Password (Again)',
widget=forms.PasswordInput()
)
问题是每个字段都显示在一行中。如何为所有字段设置不同的行?