Portugal (pt)

Forms

django_localflavot_pt.forms

Contains PT-specific Django form helpers.

class localflavor.pt.forms.PTCitizenCardNumberField(*, 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 field which validates Portuguese Citizen Card numbers (locally CC - ‘Cartão do Cidadão’).

  • Citizen Card numbers have the format XXXXXXXXXYYX or XXXXXXXX-XYYX
    (where X is a digit and Y is an alphanumeric character).
  • Citizen Card numbers validate as per http://bit.ly/RP0BzW.
  • The input string may or may not have an hyphen separating the identity number from the document’s check-digits.
  • This field does NOT validate old ID card numbers (locally BI - ‘Bilhete de Identidade’).
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.pt.forms.PTRegionSelect(attrs=None)[source]

A select widget which uses a list of Portuguese regions as its choices.

  • Regions correspond to the Portuguese ‘distritos’ and ‘regiões autónomas’ as per ISO3166:2-PT.
class localflavor.pt.forms.PTSocialSecurityNumberField(*, 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 field which validates Portuguese Social Security numbers.

(locally NISS - ‘Número de Identificação na Segurança Social’). - Social Security numbers must be in the format XYYYYYYYYYY (where X is either 1 or 2 and Y is any other digit).

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.pt.forms.PTZipCodeField(*args, **kwargs)[source]

A field which validates Portuguese zip codes.

NOTE - Zip codes have the format XYYY-YYY (where X is a digit between 1 and 9 and Y is any other digit).

Data

localflavor.pt.pt_regions.REGION_CHOICES = (('01', 'Aveiro'), ('02', 'Beja'), ('03', 'Braga'), ('04', 'Bragança'), ('05', 'Castelo Branco'), ('06', 'Coimbra'), ('07', 'Évora'), ('08', 'Faro'), ('09', 'Guarda'), ('10', 'Leiria'), ('11', 'Lisboa'), ('12', 'Portalegre'), ('13', 'Porto'), ('14', 'Santarém'), ('15', 'Setúbal'), ('16', 'Viana do Castelo'), ('17', 'Vila Real'), ('18', 'Viseu'), ('20', 'Região Autónoma da Madeira'), ('30', 'Região Autónoma dos Açores'))

A tuple representing Portuguese regions (as per ISO3166:2-PT).