Brazil (br)

Forms

BR-specific Form helpers

class localflavor.br.forms.BRCNPJField(required=True, widget=None, label=None, initial=None, help_text='', error_messages=None, show_hidden_initial=False, validators=[], localize=False, disabled=False, label_suffix=None)[source]

A form field that validates input as Brazilian CNPJ.

Input can either be of the format XX.XXX.XXX/XXXX-XX or be a group of 14 digits.

clean(value)[source]

Value can be either a string in the format XX.XXX.XXX/XXXX-XX or a group of 14 characters.

class localflavor.br.forms.BRCPFField(max_length=14, min_length=11, *args, **kwargs)[source]

A form field that validates a CPF number or a CPF string. A CPF number is compounded by XXX.XXX.XXX-VD. The two last digits are check digits.

More information: http://en.wikipedia.org/wiki/Cadastro_de_Pessoas_F%C3%ADsicas

clean(value)[source]

Value can be either a string in the format XXX.XXX.XXX-XX or an 11-digit number.

class localflavor.br.forms.BRPhoneNumberField(required=True, widget=None, label=None, initial=None, help_text='', error_messages=None, show_hidden_initial=False, validators=[], localize=False, disabled=False, label_suffix=None)[source]

A form field that validates input as a Brazilian phone number, that must be in either of the following formats: XX-XXXX-XXXX or XX-XXXXX-XXXX.

class localflavor.br.forms.BRProcessoField(max_length=25, min_length=20, *args, **kwargs)[source]

A form field that validates a Legal Process(Processo) number or a Legal Process string. A Processo number is compounded by NNNNNNN-DD.AAAA.J.TR.OOOO. The two DD digits are check digits. More information: http://www.cnj.jus.br/busca-atos-adm?documento=2748

New in version 1.2.

clean(value)[source]

Value can be either a string in the format NNNNNNN-DD.AAAA.J.TR.OOOO or an 20-digit number.

class localflavor.br.forms.BRStateChoiceField(required=True, widget=None, label=None, initial=None, help_text=None)[source]

A choice field that uses a list of Brazilian states as its choices.

class localflavor.br.forms.BRStateSelect(attrs=None)[source]

A Select widget that uses a list of Brazilian states/territories as its choices.

class localflavor.br.forms.BRZipCodeField(max_length=None, min_length=None, *args, **kwargs)[source]

A form field that validates input as a Brazilian zip code, with the format XXXXX-XXX.

Data

localflavor.br.br_states.STATE_CHOICES = (('AC', 'Acre'), ('AL', 'Alagoas'), ('AP', 'Amapá'), ('AM', 'Amazonas'), ('BA', 'Bahia'), ('CE', 'Ceará'), ('DF', 'Distrito Federal'), ('ES', 'Espírito Santo'), ('GO', 'Goiás'), ('MA', 'Maranhão'), ('MT', 'Mato Grosso'), ('MS', 'Mato Grosso do Sul'), ('MG', 'Minas Gerais'), ('PA', 'Pará'), ('PB', 'Paraíba'), ('PR', 'Paraná'), ('PE', 'Pernambuco'), ('PI', 'Piauí'), ('RJ', 'Rio de Janeiro'), ('RN', 'Rio Grande do Norte'), ('RS', 'Rio Grande do Sul'), ('RO', 'Rondônia'), ('RR', 'Roraima'), ('SC', 'Santa Catarina'), ('SP', 'São Paulo'), ('SE', 'Sergipe'), ('TO', 'Tocantins'))

An alphabetical list of Brazilian states for use as choices in a formfield