Python Django Authentication Users and Authorization Custom User Manager

Dillon Ginley
Dillon Ginley
Python Web Development Techdegree Graduate 26,890 Points

What is wrong with my password call here?

This looks correct to me; what is the syntax error?

accounts/models.py
from django.contrib.auth.models import BaseUserManager

class UserManager(BaseUserManager):
    def create_user(self, email, dob, accepted_tos, password):
        if accepted_tos:
            raise ValueError("Users must have an accepted_tos")

        user = self.model(
            email=self.normalize_email(email),
            dob=dob,
            accepted_tos=accepted_tos
        )
        user.set_password(password)
        user.save()
        return user

1 Answer

you need to change accepted_tos=accepted_tos to accepted_tos=True that's what I can see that's wrong if another error pops up after you tried it let me know