Opened 8 years ago

Closed 8 years ago

#24913 closed Bug (duplicate)

Localize filter tag doesn't work for thousand separator then USE_L10N is False

Reported by: Krupin Dmitry Owned by: Ana Balica
Component: Internationalization Version: 1.7
Severity: Normal Keywords: localize
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ana Balica)

In settings.py set
USE_L10N = False
USE_THOUSAND_SEPARATOR = True

In the template do this:

 {% localize on %}
      {{ object.price }}
 {% endlocalize %}

or

{{ object.price|localize }}

Switching on the localization doesn't trigger the USE_THOUSAND_SEPARATOR setting in case it's set to True.

I think in util.formats.number_format function should be something like this

 if use_l10n:
      force_grouping = True

Change History (5)

comment:1 Changed 8 years ago by Ana Balica

Triage Stage: UnreviewedAccepted

Been able to reproduce with the latest Django 1.9.dev20150604012012. The documentation isn't very specific on this topic, even though it would feel natural that by switching on localization, the setting of USE_THOUSAND_SEPARATOR should be respected.

comment:2 Changed 8 years ago by Ana Balica

Needs tests: set
Owner: changed from nobody to Ana Balica
Status: newassigned

comment:3 Changed 8 years ago by Ana Balica

Description: modified (diff)
Summary: localize filter tag not work for thousand separator then USE_L10N is FalseLocalize filter tag doesn't work for thousand separator then USE_L10N is False

comment:4 Changed 8 years ago by Tim Graham

Elsewhere docs say, "When USE_L10N is set to True and if this is also set to True, Django will use the values of THOUSAND_SEPARATOR and NUMBER_GROUPING to format numbers." so I think this might be invalid.

comment:5 Changed 8 years ago by Markus Holtermann

Resolution: duplicate
Status: assignedclosed

This is a duplicate of #21544 which I think is a valid issue.

Note: See TracTickets for help on using tickets.
Back to Top