diff --git a/TODO b/TODO index ae8af3960..8a13b2955 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,6 @@ Things to implement before first public release * Password change/reset pages -* Registration should ask for name Possible features for future releases diff --git a/accounts/forms.py b/accounts/forms.py index 54b6e256c..87afcf5b6 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -33,4 +33,21 @@ class ContactForm(forms.Form): ) 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 diff --git a/html/registration/registration_form.html b/html/registration/registration_form.html index dfad54be2..1d641be53 100644 --- a/html/registration/registration_form.html +++ b/html/registration/registration_form.html @@ -16,36 +16,10 @@
diff --git a/urls.py b/urls.py index ea6fc0459..b59c1b893 100644 --- a/urls.py +++ b/urls.py @@ -1,4 +1,5 @@ from django.conf.urls.defaults import patterns, include, url +from django.utils.translation import ugettext_lazy as _ from django.contrib import admin from accounts.forms import RegistrationForm @@ -22,7 +23,7 @@ urlpatterns = patterns('', # Auth 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'^contact/', 'accounts.views.contact'),