Hi,
I'm using Django's User management in combination with UserProfiles that are linked to the User model with ForeignKeys. Now, I'd like to make fields from the users' profiles searchable from the UserAdmin.
My best guess was to user something like this:
class UserAdmin(auth.admin.UserAdmin):
def field_name(self, obj):
return obj.get_profile().name
list_display = ('field_name',)
search_fields = ('field_name',)
Whereas list_display works fine, search_fields gives me an error message when submitting a query: *Cannot resolve keyword 'field_name' into field. Choices are: [...]*
Do you have any clue on how to do this? Thank you in advance.