title: TypeError at / string indices must be integers
body: <p>I am trying to make a custom made user creation form where user can type username,password and email to register in my site. but I am unable to debug this error. What kind of type error its referring to? I am using django 2.1 and postgresql 10.3 as db.</p>
  
  <p>forms.py </p>
  
  <pre><code>from django import forms
  
  class SignUpForm(forms.Form):
      username = forms.CharField(max_length=20)
      password = forms.CharField(widget=forms.PasswordInput(attrs={'placeholder':'password'}))
      password_confirmation = forms.CharField(widget=forms.PasswordInput(attrs={'placeholder':'password confirmation'}))
      email = forms.EmailField()
  
     def clean(self):
      password = self.cleaned_data.get('password')
      password_confirmation = self.cleaned_data.get('password_confirmation')
      print(password)
      print(password_confirmation)
      if password != password_confirmation:
          raise forms.ValidationError('Password Must Match')
      return password
  </code></pre>
  
  <p>urls.py</p>
  
  <pre><code>from django.urls import path
  from .views import SignUpView
  urlpatterns = [
      path('',SignUpView,name = 'signup')
  ]
  </code></pre>
  
  <p>views.py </p>
  
  <pre><code>from django.shortcuts import render
  from .forms import SignUpForm
  from django.contrib.auth.models import User
  from django.shortcuts import HttpResponse
  
  def SignUpView(request):
      if request.method == 'POST':
          form = SignUpForm(request.POST)
          if form.is_valid():
              username = form.cleaned_data['username']
              password = form.cleaned_data['password']
              email = form.cleaned_data['email']
              user = User(request,username=username,email=email)
              user.set_password(password)
              user.save()
              return HttpResponse('User Created')
      else:
          form =SignUpForm()
      return render(request,'signup.html',{'form':form})
  </code></pre>
  
  <p>TraceBack Error</p>
  
  <p>Environment:</p>
  
  <pre><code>Request Method: POST
  Request URL: http://127.0.0.1:8000/
  
  Django Version: 2.0.5
  Python Version: 3.6.3
  Installed Applications:
  ['django.contrib.admin',
   'django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.sessions',
   'django.contrib.messages',
   'django.contrib.staticfiles',
   'account']
  Installed Middleware:
  ['django.middleware.security.SecurityMiddleware',
   'django.contrib.sessions.middleware.SessionMiddleware',
   'django.middleware.common.CommonMiddleware',
   'django.middleware.csrf.CsrfViewMiddleware',
   'django.contrib.auth.middleware.AuthenticationMiddleware',
   'django.contrib.messages.middleware.MessageMiddleware',
   'django.middleware.clickjacking.XFrameOptionsMiddleware']
  
  
  
  Traceback:
  
  File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\exception.py" in inner
    35.             response = get_response(request)
  
  File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py" in _get_response
    128.                 response = self.process_exception_by_middleware(e, request)
  
  File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py" in _get_response
    126.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)
  
  File "C:\Users\HP\Desktop\muvi_2\account\views.py" in SignUpView
    10.             username = form.cleaned_data['username']
  
  Exception Type: TypeError at /
  Exception Value: string indices must be integers
  </code></pre>