python - Error in Inherit BaseUser in Django 1.7b4 -
python - Error in Inherit BaseUser in Django 1.7b4 -
i'm trying add together custom field existed django's user model.
i want fields of default user model(including password hashing functionality) + custom field has_car
, did ...
class myuser(abstractbaseuser): has_car = models.booleanfield(default=false)
and register in admin panel admin.site.register(myuser)
when seek add together open model in admin panel error.
operationalerror @ /admin/myapp/myuser/ (1054, "unknown column 'myapp_myuser.id' in 'field list'")
i'm not sure if mysqldb error or what?
i know can utilize onetoone or foreignkey field want extend user model. again, django==1.7b4 + mysql
if you're looking add together custom fields standard user
model, user model should inherit abstractuser
instead of abstractbaseuser
.
don't forget set:
auth_user_model = 'myapp.myuser'
https://docs.djangoproject.com/en/dev/topics/auth/customizing/#extending-django-s-default-user
python django python-2.7 django-models django-admin
Comments
Post a Comment