title: Creating Custom user registration form Django
body: <p>I am trying to create custom user registration forms in Django but I am getting the following error. Everything on my page displays correctly however I get the error. </p>
  
  <p>Error:</p>
  
  <pre><code>Exception Type: KeyError
  Exception Value:    'First name'
  </code></pre>
  
  <p>My form.py:</p>
  
  <pre><code>from django import forms            
  from django.contrib.auth.models import User   # fill in custom user info then save it 
  from django.contrib.auth.forms import UserCreationForm      
  
  class MyRegistrationForm(UserCreationForm):
      email = forms.EmailField(required = True)
      first_name = forms.CharField(required = False)
      last_name = forms.CharField(required = False)
      birtday = forms.DateField(required = False)
  
  
  
      class Meta:
          model = User
          fields = ('username', 'email', 'password1', 'password2')        
  
      def save(self,commit = True):   
          user = super(MyRegistrationForm, self).save(commit = False)
          user.email = self.cleaned_data['email']
          user.first_name = self.cleaned_data['First name']
          user.last_name = self.cleaned_data['Last name']
          user.birthday = self.cleaned_data['Birthday']
  
  
          if commit:
              user.save()
  
          return user
  </code></pre>
  
  <p>My views.py</p>
  
  <pre><code>from django.shortcuts import render
  from django.http import HttpResponseRedirect    
  from django.contrib import auth                 
  from django.core.context_processors import csrf 
  from forms import MyRegistrationForm
  
  def register_user(request):
      if request.method == 'POST':
          form = MyRegistrationForm(request.POST)     # create form object
          if form.is_valid():
              form.save()
              return HttpResponseRedirect('/accounts/register_success')
      args = {}
      args.update(csrf(request))
      args['form'] = MyRegistrationForm()
      print args
      return render(request, 'register.html', args)
  </code></pre>