создаю форму
from django import forms
class RegForm(forms.Form):
email = forms.EmailField(max_length=128, required=True, label=(u'Email'), help_text=(u"Email address of account"))
password = forms.CharField(widget=forms.PasswordInput(), required=True, label=(u'Password'))
password2 = forms.CharField(widget=forms.PasswordInput(), required=True, label=(u'Password_return'))
def reg(request):
if request.method == 'POST':
form = RegForm(request.POST)
if form.is_valid():
return HttpResponseRedirect('/')
else:
form = RegForm()
return render_to_response('reg.html', {'form': form})
{% block content %}
{% if form.errors %}
<p>Error</p>
{% endif %}
<form method="post" action=".">
<table>
<tr><td>{{ form.email.label_tag }}</td><td>{{ form.email }}</td></tr>
<tr><td>{{ form.password.label_tag }}</td><td>{{ form.password }}</td></tr>
<tr><td>{{ form.password2.label_tag }}</td><td>{{ form.password2 }}</td></tr>
</table>
<input type="submit" value="reg" />
</form>
{% endblock %}
<form method="post" action=".">
<table>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
</table>
<input type="submit" value="reg" />
</form>