Commit 71be3bf3 authored by Michal Čihař's avatar Michal Čihař

Own registration page asking for full name as well

parent 9eb9753b
Things to implement before first public release Things to implement before first public release
* Password change/reset pages * Password change/reset pages
* Registration should ask for name
Possible features for future releases Possible features for future releases
......
...@@ -33,4 +33,21 @@ class ContactForm(forms.Form): ...@@ -33,4 +33,21 @@ class ContactForm(forms.Form):
) )
class RegistrationForm(RegistrationFormUniqueEmail): class RegistrationForm(RegistrationFormUniqueEmail):
pass first_name = forms.CharField(label = _('First name'))
last_name = forms.CharField(label = _('Last name'))
def __init__(self, *args, **kwargs):
super(RegistrationForm, self).__init__(*args, **kwargs)
self.fields['username'].label = _('Username')
self.fields['email'].label = _('Email address')
self.fields['password1'].label = _('Password')
self.fields['password2'].label = _('Password (again)')
def save(self, *args, **kwargs):
new_user = super(RegistrationForm, self).save(*args, **kwargs)
new_user.first_name = self.cleaned_data['first_name']
new_user.last_name = self.cleaned_data['last_name']
new_user.save()
return new_user
...@@ -16,36 +16,10 @@ ...@@ -16,36 +16,10 @@
<form action="{% url 'registration.views.register' %}" method="post" accept-charset="utf-8"> <form action="{% url 'registration.views.register' %}" method="post" accept-charset="utf-8">
{% csrf_token %} {% csrf_token %}
<fieldset> <table>
<legend>{% trans "User registration" %}</legend> {{ form.as_table }}
<label for="id_username">{% trans "Username" %}</label> </table>
<p>{{ form.username }} <p>{% trans "By registering you agree to use your name and email in Git commits." %}</p>
{% if form.username.errors %}
<br /><span class="ui-state-error">* {{ form.username.errors|join:"; " }}</span>
{% endif %}
</p>
<label for="id_email">{% trans "E-mail" %} {% trans "(will be used as Git author)" %}</label>
<p>{{ form.email }}
{% if form.email.errors %}
<br /><span class="ui-state-error">* {{ form.email.errors|join:"; " }}</span>
{% endif %}
</p>
<label for="id_password1">{% trans "Password" %}</label>
<p>{{ form.password1 }}
{% if form.password1.errors %}
<br /><span class="ui-state-error">* {{ form.password1.errors|join:"; " }}</span>
{% endif %}
</p>
<label for="id_password2">{% trans "Password (again)" %}</label>
<p>{{ form.password2 }}
{% if form.password2.errors %}
<br /><span class="ui-state-error">* {{ form.password2.errors|join:"; " }}</span>
{% endif %}
</p>
{% if form.non_field_errors %}
<ul class="ui-state-error">{{ form.non_field_errors.as_ul }}</ul>
{% endif %}
</fieldset>
<p><input type="submit" value="{% trans 'Register' %}" /></p> <p><input type="submit" value="{% trans 'Register' %}" /></p>
</form> </form>
......
from django.conf.urls.defaults import patterns, include, url from django.conf.urls.defaults import patterns, include, url
from django.utils.translation import ugettext_lazy as _
from django.contrib import admin from django.contrib import admin
from accounts.forms import RegistrationForm from accounts.forms import RegistrationForm
...@@ -22,7 +23,7 @@ urlpatterns = patterns('', ...@@ -22,7 +23,7 @@ urlpatterns = patterns('',
# Auth # Auth
url(r'^accounts/', include('registration.urls')), url(r'^accounts/', include('registration.urls')),
url(r'^accoints/register/$', 'registration.views.register', {'form_class': RegistrationForm}, name='registration_register'), url(r'^accoints/register/$', 'registration.views.register', {'form_class': RegistrationForm, 'extra_context': {'title': _('User registration')}}, name='registration_register'),
url(r'^accounts/profile/', 'accounts.views.profile'), url(r'^accounts/profile/', 'accounts.views.profile'),
url(r'^contact/', 'accounts.views.contact'), url(r'^contact/', 'accounts.views.contact'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment