django-relationships icon indicating copy to clipboard operation
django-relationships copied to clipboard

Django 1.5 CustomUser.first_name and Admin

Open lpalomo opened this issue 11 years ago • 3 comments

It appears to be that you are using the field first_name for displaying the relationships on the admin but there is no guarranty that a CustomUser would have this field. I think the only field that would be there for sure is USERNAME_FIELD [get_username()]. I'm pretty new with Django so please correct me if I'm wrong.

lpalomo avatar Feb 13 '14 13:02 lpalomo

Similar problem, I have a custom user model and I get this error: 'username' is not a callable or an attribute of 'UserRelationshipAdmin' or found in the model 'MyCustomUser'. Evidently I don't have a 'username' field in my custom user model, I have an email defined as USERNAME_FIELD in the model instead

EDIT: I think the problem is in admin.py when importing from django.contrib.auth.admin import UserAdmin The UserAdmin is using the fields for the built-in User model, and when registering: admin.site.register(User, UserRelationshipAdmin) we have the error, instead of importing UserAdmin we should be able to import the custom user admin, I'm also pretty new to django so I couldn't find a solution yet.

nelsongallardo avatar Feb 14 '14 21:02 nelsongallardo

Did any of you fixed this problem?

robinlery avatar Mar 07 '14 21:03 robinlery

I've moved to django-friendship. A workaround would be to unregister django-relationship from the admin.

lpalomo avatar Mar 07 '14 22:03 lpalomo