Re: New function to sort words with accents.

2015-05-06 Thread Anssi Kääriäinen
There is a ticket for collations support. See
https://code.djangoproject.com/ticket/21181. I think a Collate
expression would be very welcome addition.

On Wed, May 6, 2015 at 8:52 AM, Aymeric Augustin
 wrote:
> If you're using PosgreSQL, django.contrib.postgres provides such a function.
>
> --
> Aymeric.
>
> Le 6 mai 2015 à 02:52, Paulo Maciel  a écrit :
>
> I am returning the query Something.objects.all().order_by(Lower('name'))
> but the order is not respecting names that start with accent, causing these
> results appear at the end of ordering. We need a function to ignore accents
> and order correctly names with accents, as well as function Lower treats the
> results.
>
> Currently:
>
> arroz
> baleia
> dado
> limão
> xerox
> água
> ótimo
>
> As it should be:
>
> água
> arroz
> baleia
> dado
> limão
> ótimo
> xerox
>
>
> We need a function like it to fix the problem:
> Person.objects.all().order_by(Unaccent('name'))
>
> This is a priority issue because it affects thousands of Brazilians and
> other nationalities who use Portuguese.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/27620089-a89e-4e13-9576-637e37395754%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/F4794B20-EA76-4A41-A4CD-8D2DA473E82F%40polytechnique.org.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CALMtK1EdrJDDy35NdD%2BRghU4_k8VsJ45CQfXOr3CTT1pjCVv%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: New function to sort words with accents.

2015-05-05 Thread Aymeric Augustin
If you're using PosgreSQL, django.contrib.postgres provides such a function.

-- 
Aymeric.

> Le 6 mai 2015 à 02:52, Paulo Maciel  a écrit :
> 
> I am returning the query Something.objects.all().order_by(Lower('name'))  but 
> the order is not respecting names that start with accent, causing these 
> results appear at the end of ordering. We need a function to ignore accents 
> and order correctly names with accents, as well as function Lower treats the 
> results.
> 
> Currently:
> 
> arroz
> baleia
> dado
> limão
> xerox
> água
> ótimo
> 
> As it should be:
> 
> água
> arroz
> baleia
> dado
> limão
> ótimo
> xerox
> 
> 
> We need a function like it to fix the problem:
> Person.objects.all().order_by(Unaccent('name'))
> 
> This is a priority issue because it affects thousands of Brazilians and other 
> nationalities who use Portuguese.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/27620089-a89e-4e13-9576-637e37395754%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/F4794B20-EA76-4A41-A4CD-8D2DA473E82F%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.


Re: New function to sort words with accents.

2015-05-05 Thread Michael Manfre
Hi Paulo,

Your issue can be solved by modifying the database collation or with
application code (E.g. SlugField). The django-developer mailing is for
discussion of the Django framework. The django-users mailing list is the
appropriate place to start/continue a discussion about how you can resolve
this issue.

Regards,
Michael Manfre

On Tue, May 5, 2015 at 8:52 PM, Paulo Maciel 
wrote:

> I am returning the query Something.objects.all().order_by(Lower('name'))
> but the order is not respecting names that start with accent, causing these
> results appear at the end of ordering. We need a function to ignore accents
> and order correctly names with accents, as well as function Lower treats
> the results.
>
> *Currently:*
>
> arroz
> baleia
> dado
> limão
> xerox
> água
> ótimo
>
> *As it should be:*
>
> água
> arroz
> baleia
> dado
> limão
> ótimo
> xerox
>
>
> We need a function like it to fix the problem:
> Person.objects.all().order_by(Unaccent('name'))
>
> This is a priority issue because it affects thousands of Brazilians and
> other nationalities who use Portuguese.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/27620089-a89e-4e13-9576-637e37395754%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
GPG Fingerprint: 74DE D158 BAD0 EDF8
keybase.io/manfre

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAGdCwBsHSzu3Xs0%3DTbVtJw43_Bq80sLsHamsfEYFXDJO4XuA8w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: New function to sort words with accents.

2015-05-05 Thread Stephen J. Butler
This is part of the database collation, and as I understand the Django
docs it's not something Django handles internally. It's something you
set/tweak inside your database.

What database are you using? On MySQL the docs say to set a column
collation. On Oracle I believe you can change the NLS_SORT init
parameter.

On Tue, May 5, 2015 at 7:52 PM, Paulo Maciel  wrote:
> I am returning the query Something.objects.all().order_by(Lower('name'))
> but the order is not respecting names that start with accent, causing these
> results appear at the end of ordering. We need a function to ignore accents
> and order correctly names with accents, as well as function Lower treats the
> results.
>
> Currently:
>
> arroz
> baleia
> dado
> limão
> xerox
> água
> ótimo
>
> As it should be:
>
> água
> arroz
> baleia
> dado
> limão
> ótimo
> xerox
>
>
> We need a function like it to fix the problem:
> Person.objects.all().order_by(Unaccent('name'))
>
> This is a priority issue because it affects thousands of Brazilians and
> other nationalities who use Portuguese.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/27620089-a89e-4e13-9576-637e37395754%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAD4ANxUHOEG3qbXEtLq7yTuVxYQUry-y3agFWaXCNVo9Gv6zag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


New function to sort words with accents.

2015-05-05 Thread Paulo Maciel
I am returning the query Something.objects.all().order_by(Lower('name'))  
but the order is not respecting names that start with accent, causing these 
results appear at the end of ordering. We need a function to ignore accents 
and order correctly names with accents, as well as function Lower treats 
the results.

*Currently:*

arroz
baleia
dado
limão
xerox
água
ótimo

*As it should be:*

água
arroz
baleia
dado
limão
ótimo
xerox


We need a function like it to fix the problem:
Person.objects.all().order_by(Unaccent('name'))

This is a priority issue because it affects thousands of Brazilians and 
other nationalities who use Portuguese.


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/27620089-a89e-4e13-9576-637e37395754%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.