I am creating an application where I want the admin site to display the User and the UserProfile (my extensions to the User class) together in the list view.
Currently, I have something like: class UserProfile(models.Model): " User profile class " # That field link toward the django user class user=models.ForeignKey(User, unique=True) personal_title=models.CharField(max_length=20, null=True, blank=True) phone=models.CharField('telephone number', max_length=50, null=True, blank=True, help_text='Please include the country code') I am displaying the my own version of User in the admin site like this: class UserProfileInline(admin.StackedInline): model = UserProfile class MyUserAdmin(UserAdmin): inlines = [ UserProfileInline, ] admin.site.unregister(User) admin.site.register(User, MyUserAdmin) My problem is that I want my User Profile fields to be displayed in the User list page (http://.../admin/auth/user/) and be able to filter and sort by these (User Profile) fields. But admin does not seem to get access to the get_profile method: list_display = ('first_name', 'last_name', #get_profile, #adding this does not give access ) I can of course write a function in MyUserAdmin to give access to individual UserProfile properties, and they will be diplayed correctly. e.g. class MyUserAdmin(UserAdmin): inlines = [ UserProfileInline, ] def home_page(self): return self.get_profile().home_page list_display = ('first_name', 'last_name', home_page ) But I am not able to sort by these values (nor filter, nor search). Is there anyway to have the admin site have access to the UserProfile model as if it was part of the User model? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---