On Oct 2, 3:20 am, booty <boot...@gmail.com> wrote:
> 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.
>
[snip]

> 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?

Methods and properties that you have in either the AdminModel, or the
Model itself, that take no arguments, can be used in the
list_display.  Which appears to be what you have done.

Is there anything else you are trying to achieve other than this?

Matt.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to