Mexico (mx)

Forms

Mexican-specific form helpers.

localflavor.mx.forms.CURP_INCONVENIENT_WORDS = ['BACA', 'BAKA', 'BUEI', 'BUEY', 'CACA', 'CACO', 'CAGA', 'CAGO', 'CAKA', 'CAKO', 'COGE', 'COGI', 'COJA', 'COJE', 'COJI', 'COJO', 'COLA', 'CULO', 'FALO', 'FETO', 'GETA', 'GUEI', 'GUEY', 'JETA', 'JOTO', 'KACA', 'KACO', 'KAGA', 'KAGO', 'KAKA', 'KAKO', 'KOGE', 'KOGI', 'KOJA', 'KOJE', 'KOJI', 'KOJO', 'KOLA', 'KULO', 'LILO', 'LOCA', 'LOCO', 'LOKA', 'LOKO', 'MAME', 'MAMO', 'MEAR', 'MEAS', 'MEON', 'MIAR', 'MION', 'MOCO', 'MOKO', 'MULA', 'MULO', 'NACA', 'NACO', 'PEDA', 'PEDO', 'PENE', 'PIPI', 'PITO', 'POPO', 'PUTA', 'PUTO', 'QULO', 'RATA', 'ROBA', 'ROBE', 'ROBO', 'RUIN', 'SENO', 'TETA', 'VACA', 'VAGA', 'VAGO', 'VAKA', 'VUEI', 'VUEY', 'WUEI', 'WUEY']

This is the list of inconvenient words according to the Anexo 2 of the document described in the next link: http://portal.veracruz.gob.mx/pls/portal/url/ITEM/444112558A57C6E0E040A8C02E00695C

class localflavor.mx.forms.MXCLABEField(min_length=18, max_length=18, *args, **kwargs)[source]

This field validates a CLABE (Clave Bancaria Estandarizada).

A CLABE is a 18-digits long number. The first 6 digits denote bank and branch number. The remaining 12 digits denote an account number, plus a verifying digit.

More info: https://en.wikipedia.org/wiki/CLABE

New in version 1.4.

class localflavor.mx.forms.MXCURPField(min_length=18, max_length=18, *args, **kwargs)[source]

A field that validates a Mexican Clave Única de Registro de Población.

The CURP is integrated by a juxtaposition of characters following the next pattern:

Index Format Accepted Characters
1 X Any letter
2 X Any vowel
3-4 XX Any letter
5-10 YYMMDD Any valid date
11 X Either H or M, depending on the person’s gender
12-13 XX Any valid acronym for a state in Mexico
14-16 XXX Any consonant
17 X Any number between 0 and 9 or any letter
18 X Any number between 0 and 9
More info about this:
http://www.condusef.gob.mx/index.php/clave-unica-de-registro-de-poblacion-curp
class localflavor.mx.forms.MXRFCField(min_length=12, max_length=13, *args, **kwargs)[source]

A form field that validates a Mexican Registro Federal de Contribuyentes for either Persona física or Persona moral.

The Persona física RFC string is integrated by a juxtaposition of characters following the next pattern:

Index Format Accepted Characters
1 X Any letter
2 X Any vowel
3-4 XX Any letter
5-10 YYMMDD Any valid date
11-12 XX Any letter or number between 0 and 9
13 X Any digit between 0 and 9 or the letter A

The Persona moral RFC string is integrated by a juxtaposition of characters following the next pattern:

Index Format Accepted Characters
1-3 XXX Any letter including & and Ñ chars
4-9 YYMMDD Any valid date
10-11 XX Any letter or number between 0 and 9
12 X Any number between 0 and 9 or the letter A
More info about this:
http://es.wikipedia.org/wiki/Registro_Federal_de_Contribuyentes_(M%C3%A9xico)
class localflavor.mx.forms.MXSocialSecurityNumberField(min_length=11, max_length=11, *args, **kwargs)[source]

A field that validates a Mexican Social Security Number.

The Social Security Number is integrated by a juxtaposition of digits following the next pattern:

Index Required numbers
1-2 The number of the branch office where the Social Security Number was designated.
3-4 The year of inscription to the Social Security.
5-6 The year of birth of the Social Security Number owner.
7-10 The progressive number of procedure for the IMSS. (This digit is provided exclusively by the Institute as it regards the Folio number of such procedure).
11 The verification digit.
class localflavor.mx.forms.MXStateSelect(attrs=None)[source]

A Select widget that uses a list of Mexican states as its choices.

class localflavor.mx.forms.MXZipCodeField(*args, **kwargs)[source]

A form field that accepts a Mexican Zip Code.

More info about this:
http://en.wikipedia.org/wiki/List_of_postal_codes_in_Mexico
localflavor.mx.forms.RFC_INCONVENIENT_WORDS = ['BUEI', 'BUEY', 'CACA', 'CACO', 'CAGA', 'CAGO', 'CAKA', 'CAKO', 'COGE', 'COJA', 'COJE', 'COJI', 'COJO', 'CULO', 'FETO', 'GUEY', 'JOTO', 'KACA', 'KACO', 'KAGA', 'KAGO', 'KOGE', 'KOJO', 'KAKA', 'KULO', 'MAME', 'MAMO', 'MEAR', 'MEAS', 'MEON', 'MION', 'MOCO', 'MULA', 'PEDA', 'PEDO', 'PENE', 'PUTA', 'PUTO', 'QULO', 'RATA', 'RUIN']

This is the list of inconvenient words according to the Anexo IV of the document described in the next link: http://www.sisi.org.mx/jspsi/documentos/2005/seguimiento/06101/0610100162005_065.doc

Models

class localflavor.mx.models.MXCLABEField(*args, **kwargs)[source]

A model field that forms represent as a forms.MXCURPField field and stores the value of a valid Mexican CLABE.

New in version 1.4.

class localflavor.mx.models.MXCURPField(*args, **kwargs)[source]

A model field that forms represent as a forms.MXCURPField field and stores the value of a valid Mexican CURP.

class localflavor.mx.models.MXRFCField(*args, **kwargs)[source]

A model field that forms represent as a forms.MXRFCField field and stores the value of a valid Mexican RFC.

class localflavor.mx.models.MXSocialSecurityNumberField(*args, **kwargs)[source]

A model field that forms represent as a forms.MXSocialSecurityNumberField field and stores the value of a valid Mexican Social Security Number.

class localflavor.mx.models.MXStateField(*args, **kwargs)[source]

A model field that stores the three-letter Mexican state abbreviation in the database.

class localflavor.mx.models.MXZipCodeField(*args, **kwargs)[source]

A model field that forms represent as a forms.MXZipCodeField field and stores the five-digit Mexican zip code.

Data

localflavor.mx.mx_states.STATE_CHOICES = (('AGU', 'Aguascalientes'), ('BCN', 'Baja California'), ('BCS', 'Baja California Sur'), ('CAM', 'Campeche'), ('CHH', 'Chihuahua'), ('CHP', 'Chiapas'), ('COA', 'Coahuila'), ('COL', 'Colima'), ('DIF', 'Distrito Federal'), ('DUR', 'Durango'), ('GRO', 'Guerrero'), ('GUA', 'Guanajuato'), ('HID', 'Hidalgo'), ('JAL', 'Jalisco'), ('MEX', 'Estado de México'), ('MIC', 'Michoacán'), ('MOR', 'Morelos'), ('NAY', 'Nayarit'), ('NLE', 'Nuevo León'), ('OAX', 'Oaxaca'), ('PUE', 'Puebla'), ('QUE', 'Querétaro'), ('ROO', 'Quintana Roo'), ('SIN', 'Sinaloa'), ('SLP', 'San Luis Potosí'), ('SON', 'Sonora'), ('TAB', 'Tabasco'), ('TAM', 'Tamaulipas'), ('TLA', 'Tlaxcala'), ('VER', 'Veracruz'), ('YUC', 'Yucatán'), ('ZAC', 'Zacatecas'))

All 31 states, plus the Distrito Federal.