title: How to check if a user exists in the model that I made in Django?
body: <p>I'm making login page and data is already saved in model I made and not usercreateform... and instead of searching the user in my model(UserAuthentication), it searches in Users ...</p>
  <p><strong>view.py</strong></p>
  <pre><code>def loginpage(request):
     if request.method == &quot;POST&quot;:
         username = request.POST.get('username')
         password = request.POST.get('password')
         user = authenticate(request, username=username, password=password)
         if user is UserAuthentication: #UserAuthentication is my model where data is stored
             login(request, user)
             return redirect('index')
         else:
             messages.warning(request, &quot;Username OR Password is incorrect!&quot;)
             return redirect('login')
     else:
         return render(request, &quot;HTML/login.html&quot;, context={})
  </code></pre>
  <p><strong>login.html</strong></p>
  <pre><code>&lt;form action=&quot;#&quot; method=&quot;POST&quot;&gt;
                          {%csrf_token %}
  
                          &lt;input
                              class=&quot;text&quot;
                              type=&quot;text&quot;
                              name=&quot;username&quot;
                              placeholder=&quot;Username&quot;
                              required=&quot;&quot;
                          /&gt;
                          &lt;br /&gt;
                          &lt;br /&gt;
                          &lt;input
                              class=&quot;text&quot;
                              type=&quot;password&quot;
                              name=&quot;password&quot;
                              placeholder=&quot;Password&quot;
                              required=&quot;&quot;
                          /&gt;
                          &lt;br /&gt;
                          &lt;br /&gt;
  
                          {%for message in messages%}
                          &lt;p id=&quot;messages&quot;&gt;{{message}}&lt;/p&gt;
                          &lt;br /&gt;
                          {% endfor %}
                          &lt;input type=&quot;submit&quot; value=&quot;LOGIN&quot; /&gt;
                      &lt;/form&gt;
  </code></pre>
  <p><strong>models.py</strong></p>
  <pre><code>class UserAuthentication(models.Model):
      username  = models.CharField(max_length=100,unique=True,verbose_name=&quot;Username&quot;,error_messages={'required':'Username already exists'})
      email     = models.EmailField(unique=True, verbose_name=&quot; Email&quot;)
      password1 = models.CharField(max_length=50 ,verbose_name=&quot;Password&quot;)
      password2 = models.CharField(max_length=50 ,verbose_name=&quot;Confirmaition Password&quot;)
  
  
      def __str__(self):
          return self.username
  
  </code></pre>