dajngo2.1ユーザー名とパスワードが正しいauthticateはNoneを返します


django2.1以降のデフォルトの認証バックエンド(django.contrib.auth.backends.ModelBackend)では、このクラスのauthenticateメソッドには次のコードがあります.
    def authenticate(self, request, username=None, password=None, **kwargs):
            .....
        if user.check_password(password) and self.user_can_authenticate(user):
                return user

そしてuser_can_authenticate関数は次のとおりです.
    def user_can_authenticate(self, user):
        is_active = getattr(user, 'is_active', None)
        return is_active or is_active is None

このことからdjango 2が分かる.1後もユーザーのis_にActive判断、is_ActiveがfalseであればauthticateもNoneを返す.
以上の問題を解決するにはdjangoを継承する限りである.contrib.auth.backends.ModelBackendクラスがauthticateメソッドを書き換えるTrueを返すと、ちょうど1つのクラスが上記の操作djangoを実現する.contrib.auth.backends.AllowAllUsersModelBackend.settings.pyでバックエンド処理クラスを再指定すると、次のようになります.
AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.AllowAllUsersModelBackend']