title: Checking if username exists in Django
body: <p>I am working on a Django project where users will be able to change their usernames along with their first and last name in one form. In forms.py, I am trying to find out if the user exists. If so, it should display an error.</p>
  <p>The problem is that if user wants to change his first and last name and leaves his username in the input, it raises a validation error. Obviously, that username already exists.</p>
  <p>Is there a way to check if it equals the username of currently logged user and avoid displaying the error?</p>
  <pre><code>class ChangeNameForm(forms.ModelForm):
      username = forms.CharField(max_length=30)
      first_name = forms.CharField(max_length=255)
      last_name = forms.CharField(max_length=255)
  
      def clean_username(self):
          username = self.cleaned_data['username']
  
          try:
              user = User.objects.get(username=username)
          except user.DoesNotExist:
              return username
          raise forms.ValidationError(u'Username &quot;%s&quot; is already in use.' % username)
  </code></pre>