Cypher Systems20,454 Points
Custom User Model: Bummer! Try again!
I'm not sure why this code is not passing. The only feedback I am getting is "Bummer! Try again!" which isn't helpful at all. Any ideas?
The question is as follows:
Create a new class named User that extends AbstractBaseUser and PermissionsMixin.
Give it three fields: email, dob, and accepted_tos.
- email should be an EmailField and should be unique
- dob should be a DateField
- accepted_tos should be a BooleanField.
- All three fields should be required.
from django.contrib.auth.models import ( PermissionsMixin, BaseUserManager, AbstractBaseUser ) from django.db import models from django.utils import timezone class User(AbstractBaseUser, PermissionsMixin): email = models.EmailField(unique=True, required=True) dob = models.DateField(required=True) accepted_tos = models.BooleanField(default=False, required=True)
Chris FreemanTreehouse Moderator 56,643 Points
While the challenge text says "All three fields should be required", according the Field.required docs: "
By default, each Field class assumes the value is required...." So, adding
required=True should be a non-issue. However, the checker doesn't want the
required parameter explicitly set. Also, the challenge checker wants a default value for the
required from field arguments
add default to
Chris HowellPython Web Development Techdegree Graduate 49,482 Points
Hey Brandon Wells
Make sure you are not adding extra attributes it hasn't explicitly asked for, such as required inside each of your fields. Because the tests are looking for specific things, sometimes adding your own extras can make them fail.