text: from django.contrib.auth.models import BaseUserManager
  
  
  class UserManager(BaseUserManager):
      use_in_migrations = True
  
      def _create_user(self, username, password, email=None, **kwargs):
          email = self.normalize_email(email)
          is_staff = kwargs.pop('is_staff', False)
          is_superuser = kwargs.pop('is_superuser', False)
          user = self.model(
              username = username,
              email=email,
              is_active=True,
              is_staff=is_staff,
              is_superuser=is_superuser,
              **kwargs
          )
          user.set_password(password)
          user.save(using=self._db)
          return user
  
      def create_user(self, username, password=None, **extra_fields):
          return self._create_user(username, password, **extra_fields)
  
      def create_superuser(self, username, password, **extra_fields):
          return self._create_user(username, password, is_staff=True, is_superuser=True, **extra_fields)
  