[Answer]-Django admin unable to find subclass of models.CharField

1👍

Not sure if this will fix your error but why did you define:

def full_name(user):
    ...

outside the:

class CoombaUserAdmin(admin.ModelAdmin):
    ....

how do you pass the user object to full_name()

I would do it like this:

class CoombaUserAdmin(admin.ModelAdmin):
    list_display = ("email", "full_name", "date_joined")

    def full_name(self, obj):
        return u'%s %s' % (obj.first_name, obj.last_name)
    full_name.short_description = "Full Name"    

See https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

Example from the doc:

class PersonAdmin(admin.ModelAdmin):
    list_display = ('upper_case_name',)

    def upper_case_name(self, obj):
        return ("%s %s" % (obj.first_name, obj.last_name)).upper()
    upper_case_name.short_description = 'Name'

Leave a comment