title: django check if model exist and return that to views.py
body: <p>I am super new to django and I have the following problem.</p>
  
  <p>I have some users in my Model "User" which has an email and a username field. I created a LoginFrom in my forms.py which only accepts an email address and checks if it exist in the User database. Then I want to return to my views.py and retrieve that model and work with it.</p>
  
  <p>Very simple but, I cant do this</p>
  
  <p><code>return email_get</code></p>
  
  <p>in my forms.py as it says user already exists. The only way I can get back to views.py is by changing the form email that I got.</p>
  
  <p>Something like,</p>
  
  <p><code>email_got="found@gmail.com" 
   return email_got
  </code> </p>
  
  <p>So, how can I return to forms.py by keeping the original form email. Ps, I just want to manually check if user exist in database.</p>
  
  <p>Here's my forms.py</p>
  
  <pre><code>from django import forms
  from .models import User
  
  class LoginForm(forms.ModelForm):
      class Meta:
          model=User
          fields= ['email']
  
      def clean_email(self):
          email_got = self.cleaned_data.get('email')
  
          if User.objects.filter(email=email_got).exists():
              raise forms.ValidationError("Your email already exist")
  
          return email_got
  </code></pre>
  
  <p>And my views.py</p>
  
  <pre><code>from django.conf import settings
  from django.shortcuts import render
  from django.core.mail import send_mail      #for sending mail
  from .forms import SignUpForm, LoginForm
  from .models import User
  
  
  def login(request):
      username = None
      form=LoginForm(request.POST or None)
  
      if form.is_valid():
           new_user = form.save()
           username = getattr(new_user, 'username')
  
      context = {
          "form": form,
          "username":username,
      }       
  
      return render(request,"login.html",context)
  </code></pre>
  
  <p>Thanks a lot for the help!!</p>