title: Hi I want to put a condition: if User.objects.filter(A & B).exists(): message: "already exists"
body: <p><strong>9th</strong> line
  I want to put a condition: if User.objects.filter(A &amp; B).exists(): message: &quot;already exists&quot;</p>
  <pre><code>def connexion(request):
  if request.method == 'POST':
      nom = request.POST['nom']
      prenom = request.POST['prenom']
      mot_de_passe = request.POST['mot_de_passe']
      verifier_le_mot_de_passe = request.POST['verifier_le_mot_de_passe']
  
      if mot_de_passe == verifier_le_mot_de_passe:
          if User.objects.filter(Q(first_name=nom) &amp; Q(last_name=prenom)).exists():
              messages.info(request, &quot;existe déjà&quot;)
              return redirect('inscription')
  
          user = User.objects.create_user(username=nom, first_name=nom, last_name=prenom, password=mot_de_passe)
          user.save()
          return redirect('inscription')
      else:
          messages.info(request, 'Vérifier le mot de passe')
          return redirect('inscription')
  </code></pre>