From 5e95462b2840d6e495c3bd1c141224912667843b Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 27 Feb 2021 08:14:49 +0000 Subject: templates: Use form.as_table in registration template. This should make changes to the registration form easier. I'm particularly thinking about adding in the Django simple math captcha. --- htdocs/css/style.css | 4 +- patchwork/forms.py | 9 ++- patchwork/templates/patchwork/registration.html | 81 +------------------------ 3 files changed, 11 insertions(+), 83 deletions(-) diff --git a/htdocs/css/style.css b/htdocs/css/style.css index 243caa0..e417c69 100644 --- a/htdocs/css/style.css +++ b/htdocs/css/style.css @@ -398,10 +398,10 @@ table.form th { padding-top: 0.6em; } -table.form td.form-help { +span.helptext { font-size: smaller; padding-bottom: 1em; - padding-top: 0em; + padding-top: 1em; } table.form tr td.submitrow { diff --git a/patchwork/forms.py b/patchwork/forms.py index 24322c7..e06cfc1 100644 --- a/patchwork/forms.py +++ b/patchwork/forms.py @@ -16,10 +16,15 @@ from patchwork.models import UserProfile class RegistrationForm(forms.Form): first_name = forms.CharField(max_length=30, required=False) - last_name = forms.CharField(max_length=30, required=False) + last_name = forms.CharField(max_length=30, + required=False, + help_text='Your name is used to identify you on ' + 'the site') + email = forms.EmailField(max_length=100, label=u'Email address', + help_text='Patchwork will send a confirmation email ' + 'to this address') username = forms.RegexField(regex=r'^\w+$', max_length=30, label=u'Username') - email = forms.EmailField(max_length=100, label=u'Email address') password = forms.CharField(widget=forms.PasswordInput(), label='Password') diff --git a/patchwork/templates/patchwork/registration.html b/patchwork/templates/patchwork/registration.html index 5280b66..6cdbc5a 100644 --- a/patchwork/templates/patchwork/registration.html +++ b/patchwork/templates/patchwork/registration.html @@ -27,86 +27,9 @@ {{ error }} - {% endif %} + {% endif %} - - {{ form.first_name.label_tag }} - -{% if form.first_name.errors %} - {{ form.first_name.errors }} -{% endif %} - {{ form.first_name }} -{% if form.first_name.help_text %} -
{{ form.first_name.help_text }}
-{% endif %} - - - - - {{ form.last_name.label_tag }} - -{% if form.last_name.errors %} - {{ form.last_name.errors }} -{% endif %} - {{ form.last_name }} -{% if form.last_name.help_text %} -
{{ form.last_name.help_text }}
-{% endif %} - - - - - - - Your name is used to identify you on the site - - - - - {{ form.email.label_tag }} - -{% if form.email.errors %} - {{ form.email.errors }} -{% endif %} - {{ form.email }} -{% if form.email.help_text %} -
{{ form.email.help_text }}
-{% endif %} - - - - - - - Patchwork will send a confirmation email to this address - - - - - {{ form.username.label_tag }} - -{% if form.username.errors %} - {{ form.username.errors }} -{% endif %} - {{ form.username }} -{% if form.username.help_text %} -
{{ form.username.help_text }}
-{% endif %} - - - - - {{ form.password.label_tag }} - -{% if form.password.errors %} - {{ form.password.errors }} -{% endif %} - {{ form.password }} -{% if form.password.help_text %} -
{{ form.password.help_text }}
-{% endif %} - - + {{ form.as_table }} -- cgit v1.2.3