Subclassing an Existing Model in Django

I'm not sure why this is not working as it is similar to what the django documentation says .

I want to be able to subclass the built-in User model so that I can add additional fields to it.

from django.contrib.auth.models import User
class Person(User):
    my_extra_field = models.CharField(max_length=30)
    #...

This seems pretty simple, and as I understand it, all User methods should be available to Person. However challenge

user = Person.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword')

in django shell leads to an error.

Is it just a shell quirk (am I using iPython), or am I doing something wrong?

+3
source share
1 answer
+3

All Articles