title: working on a django usermanager and am trying to set it up to where the user can be created using username or password is my code sufficient
body: <pre><code>from django.db import models
  from django.db.models import Q
  from django.contrib.auth.models import (BaseUserManager, AbstractBaseUser)
  
  
  # Create your models here.
  </code></pre>
  <blockquote>
  <p>I need to know if I am headed in the right direction towards building a proper custom user manager....</p>
  </blockquote>
  <pre><code>class ProfileUserManager(BaseUserManager):`enter code here`
      def create_user(self, email, username, password=None):
          if not (Q(username)|Q(email)):
              raise ValueError('User must create account using username or email')
  
          user = self.model(
              email=self.normalize_email(email),
          )
  
          user.set_password(password)
          user.save(using=self._db)
          return user
  
  
      def create_superuser(self, username, email, password=None):
          user = self.create_user(
              email,
              username,
              password=password,
          )
          user.is_admin= True
          user.save(using=self._db)
          return user
  </code></pre>
  <p>Blockquote &gt; I need any direction on if I am approaching building the custom user manager to include both the username or email when creating a user manager.....</p>