Hi Mike,

One thing that occurs me is that you can override the model save() to
update another field -- one that the user doesn't have access. On that
function, you will write a new field, say `sortable_name` in which you'll
transfor the chemical name into something that will appear in the proper
order, like converting alphas to A, betas to B, etc.

When you request the list of chemicals by name order, you actually use the
`sortable_name` field, which will have all the conversions in place.

On Mon, Feb 5, 2018 at 9:55 PM, Mike Dewhirst <mi...@dewhirst.com.au> wrote:

> Chemical names start with both upper and lower case as well as Greek
> characters. Chemical names also exist in multiple non-western non-latin
> languages.
>
> To get lists of chemicals sorting more or less "correctly" I currently
> slugify with allow_unicode=True.
>
> This for example gets tert-Butyl... sorted nicely among names starting
> with upper-case T.
>
> Unfortunately the α-terpineol or beta this or  ε that all sink to the end
> of the list instead of sorting into the A, B or Es.
>
> My google-fu indicates I can sort on a property but that is slow. I have
> thought about tweaking slugify to include a table of equivalences between
> Greek and Western chars but that doesn't necessarily cater for non-Western
> character sets. Maybe an ever expanding table of equivalences?
>
> Thanks for any ideas ...
>
> 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/ms
> gid/django-users/4160ee4d-8b36-1118-1bec-2ba8ab40d891%40dewhirst.com.au.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101 <callto:+555130838101>  |  Mobile: +55 51
<callto:+5551996209291>*99907 0554*

-- 
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/CAEM7gE1%3DDRwnaOjJhf63EPXzjKGv083M-NNwCN7%2BfhbgeZRz-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to