[Fixed]-Maximum recursion error in custom auth model


The create_superuser method on your AccountManager calls itself which results in an infinite recursion, as Python has a maximum recursion depth, the infinite recursion is stopped with an exception when it is reached.

What you probably wanted to do is:

def create_superuser(self, username, password, **kwargs):
    account = self.create_user(username, password, **kwargs)
    account.is_admin = True

    return account

Leave a comment