title: Django-registration, custom registration and validation
body: <p>After some days on this problem, i need of your help !</p>
  
  <p>I need of two different registration form in extending django-registration form.</p>
  
  <p>My urls.py :</p>
  
  <pre><code>from django.conf.urls import patterns, url, include
  from views import RegistrationViewCandidate, RegistrationViewCompany
  
  urlpatterns = patterns('',
          url(r'accounts/register/company$', RegistrationViewCompany.as_view(), name='registration_company'),
          url(r'accounts/register/candidate$', RegistrationViewCandidate.as_view(), name='registration_candidate'),
          url(r'accounts/', include('registration.backends.default.urls')),
  )
  </code></pre>
  
  <p>My views.py :</p>
  
  <pre><code># -*- coding: utf-8 -*-
  from django.core.urlresolvers import reverse_lazy as _
  from registration.forms import RegistrationForm
  from registration.views import RegistrationView
  from models import Candidate, Company
  from django import forms
  from crispy_forms.helper import FormHelper
  from crispy_forms.layout import Submit, Layout, Field, Fieldset
  from crispy_forms.bootstrap import (PrependedText, PrependedAppendedText, FormActions)
  
  
  class CandidateForm(forms.ModelForm):
  
      class Meta:
          model = Candidate
          fields = ('first_name', 'last_name', 'candidate_city', 'candidate_region', 'candidate_phone',
                     'candidate_birthday','candidate_website_url', 'candidate_github_url')
  
  
  class CompanyForm(forms.ModelForm):
  
      class Meta:
          model = Company
          fields = ('comp_name', 'comp_address', 'comp_email', 'comp_region',  'comp_zip', 'comp_phone',
                    'comp_description', 'comp_city', 'comp_country', 'comp_website_url', 'comp_twitter_url',
                    'comp_fcbk_url')
  
  
  class CustomCandidateForm(RegistrationForm):
      user_class_model = forms.CharField(initial="Candidate", label="user_class_model")
      first_name = forms.CharField()
      last_name = forms.CharField()
      candidate_region = forms.CharField()
      candidate_city = forms.CharField()
      candidate_birthday = forms.DateField()
      candidate_phone = forms.CharField()
      candidate_website_url = forms.URLField(required=False)
      candidate_github_url = forms.URLField(required=False)
  
      def __init__(self, *args, **kwargs):
          super(CustomCandidateForm, self).__init__(*args, **kwargs)
          self.helper = FormHelper()
          self.helper.form_method = 'POST'
          self.helper.form_class = 'form-horizontal'
          self.helper.form_action = ''
          self.helper.label_class = 'col-sm-2'
          self.helper.field_class = 'col-sm-4'
          self.helper.layout = Layout(
              Fieldset(
                  'Account details',
                  Field('user_class_model'),
                  Field('username', css_class='input-sm'),
                  Field('email', css_class='input-sm'),
                  Field('password1'),
                  Field('password2'),
              ),
              Fieldset(
                  'Personnal Informations ',
                  Field('first_name', css_class='input-sm'),
                  Field('last_name', css_class='input-sm'),
                  Field('candidate_region', label='Region'),
                  Field('candidate_city', label='City'),
                  Field('candidate_birthday'),
                  Field('candidate_phone'),
                  Field('candidate_website_url'),
                  Field('candidate_github_url'),
              ),
  
          )
          self.helper.add_input(Submit('submit', 'Submit', css_class='btn-primary'))
  
  
  class CustomCompanyForm(RegistrationForm):
      user_class_model = forms.CharField(initial="Company", label="user_class_model")
  
  
  class RegistrationViewCompany(RegistrationView):
      form_class = CustomCompanyForm
  
  
  class RegistrationViewCandidate(RegistrationView):
      form_class = CustomCandidateForm
  
  CustomCandidateForm.base_fields.update(CandidateForm.base_fields)
  CustomCompanyForm.base_fields.update(CompanyForm.base_fields)
  </code></pre>
  
  <p>Like as you seen, i extend RegistrationView and RegistrationForm.
  My problem is on this line :</p>
  
  <pre><code>self.helper.form_action = ''
  </code></pre>
  
  <p>With this parameter for form_action, if i have an error in my form, i am redirect on the form with the raise error about the field in error. Perfect, but if i don't have errors in my form (if my form is clean), django-registration raise this error :</p>
  
  <pre><code>NotImplementedError at /user/accounts/register/candidate
  
  No exception supplied
  
  Request Method:     POST
  Request URL:    http://127.0.0.1:8000/user/accounts/register/candidate
  Django Version:     1.5.4
  Exception Type:     NotImplementedError
  Exception Location:     /home/damien/Developpements/Django/virtualenv/lib/python2.7/site-packages/registration/views.py in register, line 109
  Python Executable:  /home/damien/Developpements/Django/virtualenv/bin/python2.7
  Python Version:     2.7.4
  Python Path:    
  
  ['/home/damien/Developpements/Django/virtualenv/site_web/linuxemploi',
   '/home/damien/Developpements/Django/virtualenv/site_web/linuxemploi',
   '/home/damien/Developpements/Django/virtualenv/lib/python2.7',
   '/home/damien/Developpements/Django/virtualenv/lib/python2.7/plat-x86_64-linux-gnu',
   '/home/damien/Developpements/Django/virtualenv/lib/python2.7/lib-tk',
   '/home/damien/Developpements/Django/virtualenv/lib/python2.7/lib-old',
   '/home/damien/Developpements/Django/virtualenv/lib/python2.7/lib-dynload',
   '/usr/lib/python2.7',
   '/usr/lib/python2.7/plat-x86_64-linux-gnu',
   '/usr/lib/python2.7/lib-tk',
   '/home/damien/Developpements/Django/virtualenv/lib/python2.7/site-packages']
  
  Server time:    sam, 2 Nov 2013 14:47:26 +0100
  
  Traceback:
  File "/home/damien/Developpements/Django/virtualenv/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
    115.                         response = callback(request, *callback_args, **callback_kwargs)
  File "/home/damien/Developpements/Django/virtualenv/lib/python2.7/site-packages/django/views/generic/base.py" in view
    68.             return self.dispatch(request, *args, **kwargs)
  File "/home/damien/Developpements/Django/virtualenv/lib/python2.7/site-packages/registration/views.py" in dispatch
    79.         return super(RegistrationView, self).dispatch(request, *args, **kwargs)
  File "/home/damien/Developpements/Django/virtualenv/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
    86.         return handler(request, *args, **kwargs)
  File "/home/damien/Developpements/Django/virtualenv/lib/python2.7/site-packages/registration/views.py" in post
    35.             return self.form_valid(request, form)
  File "/home/damien/Developpements/Django/virtualenv/lib/python2.7/site-packages/registration/views.py" in form_valid
    82.         new_user = self.register(request, **form.cleaned_data)
  File "/home/damien/Developpements/Django/virtualenv/lib/python2.7/site-packages/registration/views.py" in register
    109.         raise NotImplementedError
  
  Exception Type: NotImplementedError at /user/accounts/register/candidate
  Exception Value: 
  </code></pre>
  
  <p>If i put :</p>
  
  <pre><code> self.helper.form_action = '.'
  </code></pre>
  
  <p>I have not error raise by django-registration, but if i have an error in my form (form is not clean), i am redirect on <strong>/user/accounts/register</strong> and not /user/accounts/register*<em>/candidate</em>* or <strong>/company</strong>.</p>
  
  <p>Any ideas ?</p>
  
  <p>Thanks very much</p>