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)
Change History (14)
by , 16 years ago
Attachment: | humanize_intdot.diff added |
---|
comment:1 by , 16 years ago
Cc: | added |
---|
comment:2 by , 16 years ago
Patch needs improvement: | set |
---|
comment:3 by , 16 years ago
milestone: | post-1.0 |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
comment:4 by , 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.
comment:5 by , 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 , 16 years ago
Component: | Uncategorized → Contrib apps |
---|
by , 16 years ago
Attachment: | humanize_intcomma_locale_specific.diff added |
---|
comment:7 by , 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 , 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 , 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 , 14 years ago
Component: | Contrib apps → contrib.humanize |
---|
comment:11 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:12 by , 13 years ago
Easy pickings: | unset |
---|---|
Resolution: | → fixed |
Status: | new → closed |
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_BR
are correct:
THOUSAND_SEPARATOR = '.' NUMBER_GROUPING = 3
All this probably didn't exist when the ticket was opened.
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.