diff options
author | Christopher Baines <mail@cbaines.net> | 2021-02-27 08:14:49 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2021-02-27 08:43:13 +0000 |
commit | 5e95462b2840d6e495c3bd1c141224912667843b (patch) | |
tree | 8c0700bc9fa5cd88e4b15d510b40b4367dbf5947 | |
parent | a51e7cfd95e24d6757a146e9c8e8f3aec44b226c (diff) | |
download | patchwork-5e95462b2840d6e495c3bd1c141224912667843b.tar patchwork-5e95462b2840d6e495c3bd1c141224912667843b.tar.gz |
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.
-rw-r--r-- | htdocs/css/style.css | 4 | ||||
-rw-r--r-- | patchwork/forms.py | 9 | ||||
-rw-r--r-- | 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 @@ <tr> <td colspan="2">{{ error }}</td> </tr> - {% endif %} + {% endif %} - <tr> - <td>{{ form.first_name.label_tag }}</td> - <td> -{% if form.first_name.errors %} - {{ form.first_name.errors }} -{% endif %} - {{ form.first_name }} -{% if form.first_name.help_text %} - <div class="help_text"/>{{ form.first_name.help_text }}</div> -{% endif %} - </td> - </tr> - - <tr> - <td>{{ form.last_name.label_tag }}</td> - <td> -{% if form.last_name.errors %} - {{ form.last_name.errors }} -{% endif %} - {{ form.last_name }} -{% if form.last_name.help_text %} - <div class="help_text"/>{{ form.last_name.help_text }}</div> -{% endif %} - </td> - </tr> - - <tr> - <td></td> - <td class="form-help"> - Your name is used to identify you on the site - </td> - </tr> - - <tr> - <td>{{ form.email.label_tag }}</td> - <td> -{% if form.email.errors %} - {{ form.email.errors }} -{% endif %} - {{ form.email }} -{% if form.email.help_text %} - <div class="help_text"/>{{ form.email.help_text }}</div> -{% endif %} - </td> - </tr> - - <tr> - <td></td> - <td class="form-help"> - Patchwork will send a confirmation email to this address - </td> - </tr> - - <tr> - <td>{{ form.username.label_tag }}</td> - <td> -{% if form.username.errors %} - {{ form.username.errors }} -{% endif %} - {{ form.username }} -{% if form.username.help_text %} - <div class="help_text"/>{{ form.username.help_text }}</div> -{% endif %} - </td> - </tr> - - <tr> - <td>{{ form.password.label_tag }}</td> - <td> -{% if form.password.errors %} - {{ form.password.errors }} -{% endif %} - {{ form.password }} -{% if form.password.help_text %} - <div class="help_text"/>{{ form.password.help_text }}</div> -{% endif %} - </td> - </tr> + {{ form.as_table }} <tr> <td colspan="2" class="submitrow"> |