I have a model with a status field that includes a choices argument to
provide human readable options. Because the options were changing
during development, the values stored in the database are rather
generic - S01, S02, etc. There is one view in my application that
provides a list of all the objects for this particular model with
several sort options, including the status field. I was originally
providing the ability to sort via a javascript plugin that examined
the DOM, but as the site has grown a single list for all the objects
has become unwieldy and had a significant negative impact on
performance. I'm going to use the Django pagination module to bring
things back in line, but this means I need to do my sorting on the
server side instead of the client side.

There does not, unfortunately, appear to be any way to take advantage
of Django's sorting features to sort by the human readable name. I can
(and probably will) create a database table for my status values,
which would allow me to look up the human readable names and use it to
sort. I could also use list() to create a list to which I can add my
own sortable attributes, but I'm concerned that this may leave me with
performance problems.

Are there any simpler solutions that I may be overlooking?

Thanks,
Jeromie
--~--~---------~--~----~------------~-------~--~----~
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