Opened 16 years ago

Closed 13 years ago

#9037 closed New feature (fixed)

django.contrib.humanize new filter (dotint)

Reported by: Wiliam Alves de Souza Owned by: nobody
Component: contrib.humanize Version: dev
Severity: Normal Keywords: contrib humanize
Cc: semente@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Converts an integer to a string containing dots every three digits. In Brazil we use dot not commas to separate numbers and is possible other location around the world use it too.

Attachments (2)

humanize_intdot.diff (2.4 KB ) - added by Wiliam Alves de Souza 16 years ago.
humanize_intcomma_locale_specific.diff (577 bytes ) - added by erickd 16 years ago.

Download all attachments as: .zip

Change History (14)

by Wiliam Alves de Souza, 16 years ago

Attachment: humanize_intdot.diff added

comment:1 by Guilherme M. Gondim <semente@…>, 16 years ago

Cc: semente@… added

comment:2 by Guilherme M. Gondim <semente@…>, 16 years ago

Patch needs improvement: set

comment:3 by Malcolm Tredinnick, 16 years ago

milestone: post-1.0
Triage Stage: UnreviewedDesign decision needed

This is probably not the right approach for something in core. Rather, we should make the existing filter locale-aware when we put that stuff in (the plan is to include locale data for things like numeric separators and date formats). Then the existing filter will use dots or commas as appropriate for the page's locale.

So I'm -1 on this at the moment.

comment:4 by Wiliam Alves de Souza, 16 years ago

Malcolm,
You think an approach like DATE_FORMAT, when each country has the possibility to change the default behavior of date format is the correct? What you think to create some options like NUMERIC, MONETARY, TELEPHONE and MEASUREMENT to be used internally for numeric separators, date formats, monetary values, telephone displaying and validation and measurement.

in reply to:  description comment:5 by finngruwier, 16 years ago

Replying to waa:

Converts an integer to a string containing dots every three digits. In Brazil we use dot not commas to separate numbers and is possible other location around the world use it too.

Same in many European locales. The dot is probably used in more locales then the comma.

comment:6 by Justin Lilly, 16 years ago

Component: UncategorizedContrib apps

comment:7 by anonymous, 16 years ago

This issue definitely warrants some more attention in the long run, but how about doing something simple and effective for now (see attached diff). Would this make most people happy?

comment:8 by erickd, 16 years ago

This issue definitely warrants some more attention in the long run, but how about doing something simple and effective for now (see attached diff). Would this make most people happy?

comment:9 by Malcolm Tredinnick, 16 years ago

If people want something "for now", they are free to include this filter in their code; there is absolutely nothing requiring this to be part of Django. We are not in the habit of intentionally including half-baked solutions in the core code, however. It can wait for the full-scale solution, rather than having people write code using distributed Django that contains something which is already effectively end-of-lifed.

comment:10 by Gabriel Hurley, 14 years ago

Component: Contrib appscontrib.humanize

comment:11 by Luke Plant, 14 years ago

Severity: Normal
Type: New feature

comment:12 by Aymeric Augustin, 13 years ago

Easy pickings: unset
Resolution: fixed
Status: newclosed
UI/UX: unset

This feature is now provided by the THOUSAND_SEPARATOR and NUMBER_GROUPING — from the settings when USE_L10N = False, and each locale's formats.py when USE_L10N = True.

The values for pt_BRare correct:

THOUSAND_SEPARATOR = '.'
NUMBER_GROUPING = 3

All this probably didn't exist when the ticket was opened.

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