Spain (es
)¶
Forms¶
Spanish-specific Form helpers
-
class
localflavor.es.forms.
ESCCCField
(max_length=None, min_length=None, *args, **kwargs)[source]¶ A form field that validates its input as a Spanish bank account or CCC (Codigo Cuenta Cliente).
Spanish CCC is in format EEEE-OOOO-CC-AAAAAAAAAA where:
E = entity O = office C = checksum A = accountIt’s also valid to use a space as delimiter, or to use no delimiter.
First checksum digit validates entity and office, and last one validates account. Validation is done multiplying every digit of 10 digit value (with leading 0 if necessary) by number in its position in string 1, 2, 4, 8, 5, 10, 9, 7, 3, 6. Sum resulting numbers and extract it from 11. Result is checksum except when 10 then is 1, or when 11 then is 0.
TODO: allow IBAN validation too
-
class
localflavor.es.forms.
ESIdentityCardNumberField
(only_nif=False, max_length=None, min_length=None, *args, **kwargs)[source]¶ Spanish NIF/NIE/CIF (Fiscal Identification Number) code.
Validates three diferent formats:
NIF (individuals): 12345678A CIF (companies): A12345678 NIE (foreigners): X12345678Aaccording to a couple of simple checksum algorithms.
Value can include a space or hyphen separator between number and letters. Number length is not checked for NIF (or NIE), old values start with a 1, and future values can contain digits greater than 8. The CIF control digit can be a number or a letter depending on company type. Algorithm is not public, and different authors have different opinions on which ones allows letters, so both validations are assumed true for all types.
http://es.wikipedia.org/wiki/N%C3%BAmero_de_identificaci%C3%B3n_fiscal
Changed in version 1.1.
-
class
localflavor.es.forms.
ESPhoneNumberField
(max_length=None, min_length=None, *args, **kwargs)[source]¶ A form field that validates its input as a Spanish phone number. Information numbers are ommited.
Spanish phone numbers are nine digit numbers, where first digit is 6 (for cell phones), 8 (for special phones), or 9 (for landlines and special phones)
TODO: accept and strip characters like dot, hyphen... in phone number
-
class
localflavor.es.forms.
ESPostalCodeField
(max_length=None, min_length=None, *args, **kwargs)[source]¶ A form field that validates its input as a spanish postal code.
Spanish postal code is a five digits string, with two first digits between 01 and 52, assigned to provinces code.
Data¶
-
localflavor.es.es_provinces.
PROVINCE_CHOICES
= (('01', <django.utils.functional.__proxy__ object at 0x7f953f993650>), ('02', <django.utils.functional.__proxy__ object at 0x7f953f921110>), ('03', <django.utils.functional.__proxy__ object at 0x7f953f921f10>), ('04', <django.utils.functional.__proxy__ object at 0x7f953f921850>), ('05', <django.utils.functional.__proxy__ object at 0x7f953f921490>), ('06', <django.utils.functional.__proxy__ object at 0x7f953f921c90>), ('07', <django.utils.functional.__proxy__ object at 0x7f953f921610>), ('08', <django.utils.functional.__proxy__ object at 0x7f953f921350>), ('09', <django.utils.functional.__proxy__ object at 0x7f953f9218d0>), ('10', <django.utils.functional.__proxy__ object at 0x7f953f921a10>), ('11', <django.utils.functional.__proxy__ object at 0x7f953f9212d0>), ('12', <django.utils.functional.__proxy__ object at 0x7f953f921650>), ('13', <django.utils.functional.__proxy__ object at 0x7f953f921290>), ('14', <django.utils.functional.__proxy__ object at 0x7f953f921190>), ('15', <django.utils.functional.__proxy__ object at 0x7f953f921890>), ('16', <django.utils.functional.__proxy__ object at 0x7f953f9217d0>), ('17', <django.utils.functional.__proxy__ object at 0x7f953f921990>), ('18', <django.utils.functional.__proxy__ object at 0x7f953f921950>), ('19', <django.utils.functional.__proxy__ object at 0x7f953f921050>), ('20', <django.utils.functional.__proxy__ object at 0x7f953f921b10>), ('21', <django.utils.functional.__proxy__ object at 0x7f953f9216d0>), ('22', <django.utils.functional.__proxy__ object at 0x7f953f921d50>), ('23', <django.utils.functional.__proxy__ object at 0x7f953f921d90>), ('24', <django.utils.functional.__proxy__ object at 0x7f953f921810>), ('25', <django.utils.functional.__proxy__ object at 0x7f953f921e10>), ('26', <django.utils.functional.__proxy__ object at 0x7f953f921bd0>), ('27', <django.utils.functional.__proxy__ object at 0x7f953f9210d0>), ('28', <django.utils.functional.__proxy__ object at 0x7f953f921150>), ('29', <django.utils.functional.__proxy__ object at 0x7f953f944810>), ('30', <django.utils.functional.__proxy__ object at 0x7f953f944a10>), ('31', <django.utils.functional.__proxy__ object at 0x7f953f9442d0>), ('32', <django.utils.functional.__proxy__ object at 0x7f953f944b50>), ('33', <django.utils.functional.__proxy__ object at 0x7f953f944510>), ('34', <django.utils.functional.__proxy__ object at 0x7f953f944c50>), ('35', <django.utils.functional.__proxy__ object at 0x7f953f944ed0>), ('36', <django.utils.functional.__proxy__ object at 0x7f953f944550>), ('37', <django.utils.functional.__proxy__ object at 0x7f953f944e10>), ('38', <django.utils.functional.__proxy__ object at 0x7f953f944f10>), ('39', <django.utils.functional.__proxy__ object at 0x7f953f944d50>), ('40', <django.utils.functional.__proxy__ object at 0x7f953f9445d0>), ('41', <django.utils.functional.__proxy__ object at 0x7f953f944990>), ('42', <django.utils.functional.__proxy__ object at 0x7f953f944cd0>), ('43', <django.utils.functional.__proxy__ object at 0x7f953f944e90>), ('44', <django.utils.functional.__proxy__ object at 0x7f953f944950>), ('45', <django.utils.functional.__proxy__ object at 0x7f953f944190>), ('46', <django.utils.functional.__proxy__ object at 0x7f953f9444d0>), ('47', <django.utils.functional.__proxy__ object at 0x7f953f944bd0>), ('48', <django.utils.functional.__proxy__ object at 0x7f953f944790>), ('49', <django.utils.functional.__proxy__ object at 0x7f953f944b90>), ('50', <django.utils.functional.__proxy__ object at 0x7f953f944150>), ('51', <django.utils.functional.__proxy__ object at 0x7f953f944e50>), ('52', <django.utils.functional.__proxy__ object at 0x7f953f944890>))¶ An alphabetical list of provinces
-
localflavor.es.es_regions.
REGION_CHOICES
= (('AN', <django.utils.functional.__proxy__ object at 0x7f953f942310>), ('AR', <django.utils.functional.__proxy__ object at 0x7f953f942590>), ('O', <django.utils.functional.__proxy__ object at 0x7f953f942390>), ('IB', <django.utils.functional.__proxy__ object at 0x7f9540677550>), ('PV', <django.utils.functional.__proxy__ object at 0x7f95406778d0>), ('CN', <django.utils.functional.__proxy__ object at 0x7f9540677dd0>), ('S', <django.utils.functional.__proxy__ object at 0x7f9540677e90>), ('CM', <django.utils.functional.__proxy__ object at 0x7f9540677f90>), ('CL', <django.utils.functional.__proxy__ object at 0x7f9540677d50>), ('CT', <django.utils.functional.__proxy__ object at 0x7f9540677fd0>), ('EX', <django.utils.functional.__proxy__ object at 0x7f9540677f10>), ('GA', <django.utils.functional.__proxy__ object at 0x7f9540677590>), ('LO', <django.utils.functional.__proxy__ object at 0x7f9540677890>), ('M', <django.utils.functional.__proxy__ object at 0x7f95406779d0>), ('MU', <django.utils.functional.__proxy__ object at 0x7f95406776d0>), ('NA', <django.utils.functional.__proxy__ object at 0x7f9540677990>), ('VC', <django.utils.functional.__proxy__ object at 0x7f953f991190>), ('CE', <django.utils.functional.__proxy__ object at 0x7f953f991810>), ('ML', <django.utils.functional.__proxy__ object at 0x7f953f991350>))¶ An alphabetical list of regions