title: How we can login by using email or phone number in django
body: <p>This in my backends.py page but I don't think its working because I pass both email or phone number but its not login by phone number.</p>
  
  <pre><code>from .models import UserModel
  from django.db.models import Q
  import logging
  
  
  class MyAuthBackend(object):
  
      def authenticate(self, email_or_phone_number=None, password=None):
          try:
              user = UserModel.objects.get(Q(email=email_or_phone_number) | 
                             Q(phone_number=email_or_phone_number))
              if user.check_password(password):
                  return user
              else:
                  return None
          except UserModel.DoesNotExist:
              logging.getLogger("error_logger").error("user with login %s 
                          does not exists" % login)
              return None
          except Exception as e:
              logging.getLogger("error_logger").error(repr(e))
              return None
  
      def get_user(self, user_id):
          try:
              user = UserModel.objects.get(sys_id=user_id)
              if user.is_active:
                  return user
              return None
          except UserModel.DoesNotExist:
              logging.getLogger("error_logger").error("user with %(user_id)d 
                        not found")
              return None
  </code></pre>