I have tried every which way to produce a case-insenstive list of substances in the Admin including this:

def get_queryset(self, request):
    return super(SubstanceAdmin, self).get_queryset(request).order_by(Lower('name').asc())

Which DOES work (as proven via print statement) but doesn't display that way in the Admin which uses the natural ascii order. It is the list_display feature which re-orders the substances.

I can get them sorting pseudo-insensitively by using a method to uppercase the first char of the name and passing that method to list_display.

However, that prevents the column order reversal feature which is a function of the list_display feature.

I thought a case insensitive model manager might work until I saw in the docs that subsequent order_by filtering will spoil it and I would still have to pseudo_name them anyway.

So the question is ... should I bite the bullet and add a sort field to the model and fill it with the substance name converted to lower-case?

Thanks

Mike

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b1fc1d23-b0ab-d35e-9049-9a4f6091a4f7%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Reply via email to