votes up 1

Django doesn't provide a DB representation for AnonymousUser.

Package:
django
github stars 59414
Exception Class:
NotImplementedError

Raise code

    def __hash__(self):
        return 1  # instances always return the same hash value

    def __int__(self):
        raise TypeError('Cannot cast AnonymousUser to int. Are you trying to use it in place of User?')

    def save(self):
        raise NotImplementedError("Django doesn't provide a DB representation for AnonymousUser.")

    def delete(self):
        raise NotImplementedError("Django doesn't provide a DB representation for AnonymousUser.")

    def set_password(self, raw_password):
        raise NotImplementedError("Django doesn't provide a DB representation for AnonymousUser.")

Ways to fix

votes up 1 votes down

Nov 22, 2021 kahlonmalak answer

Add a possible fix

Please authorize to post fix