title: Django help me raise validation error
body: <p>I am trying to create some kind of warning when someone enters the username that was already taken. However, all I manage to do is to redirect to static page where it says: username picked OR passwords do not match.</p>
  
  <p>This is what I have written in my views.py:</p>
  
  <pre><code>def register_user(request):
      if request.method == 'POST':
          form = MyRegistrationForm(request.POST)
          if form.is_valid():
              form.save()
              return HttpResponseRedirect('/accounts/register_success')
          else:
              return render_to_response('invalid_reg.html')
  
      args = {}
      args.update(csrf(request))
  
      args['form'] = MyRegistrationForm()
      print args
      return render_to_response('register.html', args)
  </code></pre>
  
  <p>and this is my forms.py:</p>
  
  <pre><code>class MyRegistrationForm(UserCreationForm):
      email = forms.EmailField(required=True)
  
      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.set_password(self.cleaned_data["password1"])
  
          if commit:
              user.save()
  
          return user
  </code></pre>
  
  <p>I have literally no idea how do I give a proper warning to the user.</p>
  
  <p>How can I implement some kind of validation error warning here?</p>