Problem with number format when not using L10N

173 views
Skip to first unread message

Yonel Ceruto González

unread,
Dec 3, 2013, 8:13:21 AM12/3/13
to django-d...@googlegroups.com

Deseo usar la agrupación de millares en mis formatos numéricos, for which I use the "floatformat" filter.

My configuration in "settings.py" is:
USE_L10N = False
USE_THOUSAND_SEPARATOR = True
NUMBER_GROUPING = 3

Showing my numbers without the grouping of thousands.

When I check in depth why I realize that the grouping of thousands is subject to the value of the Variable settings.USE_L10N:

django / utils / numberformat.py:

def format (...):
...
use_grouping = settings.USE_L10N and settings.USE_THOUSAND_SEPARATOR

Think it would be correct to eliminate the constraint that prohibits the display grouping of thousands, if not L10N used?

Yonel Ceruto González

unread,
Dec 3, 2013, 8:24:51 AM12/3/13
to django-d...@googlegroups.com
Rectify the frontline:

I want to use the grouping of thousands in my numeric formats, for which I use the "floatformat" filter.

Yonel Ceruto González

unread,
Dec 3, 2013, 9:46:58 AM12/3/13
to django-d...@googlegroups.com
I think the configuration of the variable USE_L10N aims at in this case, determine the format of number and not condition the use of the grouping of thousands.

Claude Paroz

unread,
Dec 3, 2013, 11:37:28 AM12/3/13
to django-d...@googlegroups.com
This is the topic of https://code.djangoproject.com/ticket/21544 where you can read my position.

Yonel Ceruto González

unread,
Dec 3, 2013, 1:10:21 PM12/3/13
to django-d...@googlegroups.com

It is understood that if I have enabled the thousands separator USE_THOUSAND_SEPARATOR = True and NUMBER_GROUPING > 0 to display all numbers with the pattern:

#THOUSAND_SEPARATOR###DECIMAL_SEPARATOR##

If is enabled or not USE_L10N only determines the "values" ​​of DECIMAL_SEPARATOR and THOUSAND_SEPARATOR according to the current locate set to LANGUAGE_CODE, but if USE_L10N = False then is display the default values.

Why USE_L10N determining use of thousands separator?

https://docs.djangoproject.com/en/dev/ref/settings/#use-l10n
Here not speak of this variable determines the use of the thousands separator.

Please clarify, thanks

Yonel Ceruto González

unread,
Dec 19, 2013, 8:25:11 AM12/19/13
to django-d...@googlegroups.com
Forgive me if at some point was arrogant, it was not my intention to impose my judgment or criticize, for me, the best framework that exists. Maybe I was not regarded with good intentions and therefore I believe the answers were focused to dodge my proposal.Most likely I knew not express well, beg a thousand pardons.

The truth is that my problem is not yet solved and the ticket was closed. Later I will address the problem and my suggestion otherwise.

For now, thank you,

Best Regards

Shai Berger

unread,
Dec 19, 2013, 4:19:42 PM12/19/13
to django-d...@googlegroups.com
Hi,

On Thursday 19 December 2013 05:25:11 Yonel Ceruto González wrote:
> Forgive me if at some point was arrogant, it was not my intention to impose
> my judgment or criticize, for me, the best framework that exists. Maybe I
> was not regarded with good intentions and therefore I believe the answers
> were focused to dodge my proposal.Most likely I knew not express well, beg
> a thousand pardons.

As the person who closed the ticket, your mail here indicates that I may have
been too harsh, and I apologize for that. I would like to assure you that your
intentions appear good, and your proposal was rejected purely on technical
reasons, mostly according to the documentation of USE_THOUSAND_SEPARATOR and
USE_L10N.

However, having looked again, I now think that you do have a case -- while for
the settings you pointed to, the documentation strongly implies the current
behavior, the documentation for NUMBER_GROUPING and THOUSAND_SEPARATOR does
support your interpretation (and in your first message you mentioned having set
NUMBER_GROUPING=3). For both these settings, the documentation says:

Note that if USE_L10N is set to True, then the locale-dictated format has
higher precedence and will be applied instead.

So -- to me, it looks like the documentation is not entirely consistent, and
should be clarified; and while changing the behavior would be problematic,
changing it to match (some) documentation should be a possibility.

I'm waiting for other opinions -- in particular, anyone involved with the
introduction of these settings, who can explain the original intentions -- to
decide if we should reopen the ticket[1] as is or change it to a documentation
ticket.

Shai.

[1] https://code.djangoproject.com/ticket/21544

Curtis Maloney

unread,
Dec 19, 2013, 6:29:48 PM12/19/13
to django-d...@googlegroups.com
I recall helping someone on #django with something similar to this, where the documentation, logical expectations and actual code went in rather different directions.

There was a condition where despite the setting being observed at one layer, a lower layer then went and ignored it anyway... will have to dig it up again...

--
Curtis



--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@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/1516598.QbdADRIKfy%40deblack.

Yonel Ceruto González

unread,
Dec 20, 2013, 8:15:58 AM12/20/13
to django-d...@googlegroups.com
Ok no problem,

Although the documentation may be inconsistent, I think the comment https://code.djangoproject.com/ticket/21544 # comment: 8, discloses a particular case where I customize the THOUSAND_SEPARATOR with USE_L10N = False. This is the source of my problem, because he expects to see the thousands separator to the display the numbers.

Yonel Ceruto González

unread,
Dec 20, 2013, 9:14:57 AM12/20/13
to django-d...@googlegroups.com
In conclusion one could say that if USE_L10N is not True then no thousands separator is displayed, of course, only thru the configuration of django.
Reply all
Reply to author
Forward
0 new messages