Tuesday, March 22, 2011

Re: sorting in /admin

Why are you doing this way ?
The better idea is to make it that way:

class YourModelAdmin(admin.ModelAdmin):
model = YourModel
list_display = [ 'firstName', 'lastName' ]

admin.site.register(YourModel, YourModelAdmin)

and i'm sure then you will be able to sort olums

On 22 Mar, 19:28, Bobby Roberts <tchend...@gmail.com> wrote:
> I am listing the following fields from the model in /admin as follows:
>
> [...snip...]
>
> def Client_Lastname(self, obj):
>      return  obj.CustomerId.lastName
>
> def Client_Firstname(self, obj):
>      return  obj.CustomerId.firstName
>
> list_display = ('Client_Firstname', 'Client_Lastname', ....)
>
> [...snip...]
>
> The Firstname and Lastname fields from the Client model drop right
> into the list fine but I cannot sort on these fields when i click the
> column header.  What do I need to do to make them sortable?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate