__str__ returned non-string (type NoneType)

hello, thanks for your answer. Well, I tried this:

type or paste code here

class CustomUser(AbstractUser):

def __str__(self):
    return self.username

but it still doesn’t work.

After that I made a change in the admin file:

admin.site.register(CustomUser, UserAdmin)

in others words, I commented out the CustomUserAdmin class and register the CustomUser model directly. Then it worked. May be the problem is in the CustomUserAdmin class? If that is true, I could’nt say why and I would like to know it