I have found others' solutions helpful, but I still am having an issue.

Using a Custom User Model and also utilizing AuthenticationForm which said it support Custom User Models, I continuously receive this error: Please enter a correct username and password. Note that both fields may be case-sensitive.

I also cannot utilize the authentication function as it always returns None .

My settings.py where inventory is my app name.

AUTH_USER_MODEL = 'inventory.User'

Here are my login portion in views.py

def login_view(request): context = {} if request.method == 'POST': # print(request.POST) form = AuthenticationForm(data=request.POST) print(form) if form.is_valid(): print('yay') elif request.method == 'GET': context['form'] = AuthenticationForm() return render(request, 'inventory/login.html', context)

Here is my models.py

class UserManager(AbstractUserManager): def create_user(self, username, first_name, last_name, perm, password): if not username: raise ValueError('Users must have a username') if not first_name: raise ValueError('Users must have a first name') if not last_name: raise ValueError('Users must have a last name') if not perm: raise ValueError('Users must have a position') user = self.model( username=username, first_name=first_name, last_name=last_name, ) if perm == 'e': user.employee = True elif perm == 'm': user.manager = True elif perm == 'o': user.owner = True user.set_password(password) user.save(using=self._db) return user class User(AbstractBaseUser, PermissionsMixin): username = models.CharField(verbose_name='username', max_length=50, unique=True,) first_name = models.CharField(verbose_name='first name', max_length=50,) last_name = models.CharField(verbose_name='last name', max_length=50,) active = models.BooleanField(default=False) employee = models.BooleanField(default=False) manager = models.BooleanField(default=False) owner = models.BooleanField(default=False) USERNAME_FIELD = 'username' REQUIRED_FIELDS = ['first_name', 'last_name'] def __str__(self): return self.first_name + ' ' + self.last_name @property def is_employee(self): return self.employee @property def is_manager(self): return self.manager @property def is_owner(self): return self.owner @property def is_active(self): return self.active objects = UserManager()

Here is login.html

<form method="POST" action="{% url 'login' %}"> {% csrf_token %} {{ form }} <input type="submit" value="login" /> </form>