title: ValueError : The given username should be set
body: <p>I am trying to write my method to add a User type object on registration. Here is the code:</p>
  
  <p>views.py</p>
  
  <pre><code>def registration(request):
  c= {}
  c.update(csrf(request))
  state = "Please Register below..."
  username = None
  email = None
  password = None
  user_success = None
  user_created = None
  if request.POST:
      username = request.POST.get('username')
      email = request.POST.get('email')
      password = request.POST.get('password')
      print "username ",username
  
  user = authenticate(username=username, password=password)
  if user is not None:
      if user.is_active:
          user_created = True
      else:
          user_created = False
  else:
          user = User.objects.create_user(username=username,password=password,email=email)
          user.save()
          user.is_active = True
          user_success = True
  
  return render_to_response('register.html',{'success':user_success,'created':user_created,'username': username},context_instance = RequestContext(request))
  </code></pre>
  
  <p>forms.py</p>
  
  <pre><code>class RegistrationForm(forms.Form):
  
  username = forms.CharField()
  email = forms.EmailField()
  password =  forms.CharField()
  </code></pre>
  
  <p>templates/register.html is:</p>
  
  <pre><code>{% extends "base.html" %}
  {% block pageContent %}
  &lt;div class="container"&gt;
  
  
      &lt;form action="/register" method="post"&gt;
  
              {% csrf_token %}
              username:
              &lt;input type="text" name="username" value="{{ username}}" /&gt;&lt;br /&gt;
              password:
              &lt;input type="password" name="password" value="" /&gt;&lt;br /&gt;
              Email:
              &lt;input type="text" name="email" value="{{email}}" /&gt;&lt;br /&gt;
  
              &lt;input type = 'submit' value='Register' /&gt;
      &lt;/form&gt;
  
  
  &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p>Can anyone please help me spot the error? Also let me know if I am doing the registration right</p>