Opened 15 years ago
Closed 12 years ago
#13473 closed New feature (invalid)
BRCPFField and BRCNPJField updates for localflavor.br
Reported by: | Felipe 'chronos' Prenholato | Owned by: | Felipe 'chronos' Prenholato |
---|---|---|---|
Component: | contrib.localflavor | Version: | dev |
Severity: | Normal | Keywords: | CPF, CNPJ, localflavorsplit |
Cc: | semente+djangoproject@…, django-l10n-portuguese@…, semente+django@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In Django 1.1 (or 1.0) are added two fields in localflavor.br.forms for CPF and CNPJ, but this ones not have a similar o models and not normalize data to save in database (look #10895). I started some changes to have model fields, number generators (useful for tests), one 'type' and integration of model fields to form fields for CPF and CNPJ. I adding here a diff of my initial work and a link to my repo at github.
Attachments (1)
Change History (14)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Has patch: | set |
---|---|
Needs documentation: | set |
Needs tests: | set |
comment:3 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:4 by , 15 years ago
Needs tests: | unset |
---|
Added tests, locale translations for pt-BR. This ticket depends of #13495 about localflavor tests refactoring to support various countries.
comment:5 by , 15 years ago
Cc: | added |
---|
comment:6 by , 15 years ago
Cc: | added; removed |
---|
by , 14 years ago
Attachment: | ticket13473.patch added |
---|
Diff of work at http://github.com/chronossc/django/tree/ticket13473 against http://github.com/django/django at file upload date. This patch contains changes requested in #13495 about refactoring of localflavor tests.
comment:10 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:11 by , 13 years ago
Cc: | added |
---|---|
Easy pickings: | unset |
UI/UX: | unset |
comment:13 by , 12 years ago
Keywords: | localflavorsplit added |
---|---|
Resolution: | → invalid |
Status: | new → closed |
django.contrib.localflavor
is now deprecated — see https://docs.djangoproject.com/en/dev/ref/contrib/localflavor/
A repository was created for each localflavor at https://github.com/django/django-localflavor-? (Replace with the country code.)
If you're still interested in this ticket, could you create a pull request on that repository?
Sorry for not resolving this issue earlier, and thanks for your input!
About
I added attachment:ticket13473.patch containing changes against trunk to have CPF/CNPJ fields in models, that use field of forms, and CPF/CNPJ types and number generators.
CPF/CNPJ types and generators are located at django.contrib.localflavor.br.br_cpfcnpj
Models and Forms fields are located at models and forms modules.
Usage
models.py
forms.py
When you type in rendered form in template any know format for input works, here as example using python shell using as base one CPF/CNPJ generated by number generators:
And here is how is stored in database:
Todo
I'm not created yet unit tests and some translations, etc, but I'll soon, if someone wanna to contribute, show errors, fixes, etc, plz take a look on for last changes.