Mexico (mx)

Forms

Mexican-specific form helpers.

localflavor.mx.forms.CURP_INCONVENIENT_WORDS = [u'BACA', u'BAKA', u'BUEI', u'BUEY', u'CACA', u'CACO', u'CAGA', u'CAGO', u'CAKA', u'CAKO', u'COGE', u'COGI', u'COJA', u'COJE', u'COJI', u'COJO', u'COLA', u'CULO', u'FALO', u'FETO', u'GETA', u'GUEI', u'GUEY', u'JETA', u'JOTO', u'KACA', u'KACO', u'KAGA', u'KAGO', u'KAKA', u'KAKO', u'KOGE', u'KOGI', u'KOJA', u'KOJE', u'KOJI', u'KOJO', u'KOLA', u'KULO', u'LILO', u'LOCA', u'LOCO', u'LOKA', u'LOKO', u'MAME', u'MAMO', u'MEAR', u'MEAS', u'MEON', u'MIAR', u'MION', u'MOCO', u'MOKO', u'MULA', u'MULO', u'NACA', u'NACO', u'PEDA', u'PEDO', u'PENE', u'PIPI', u'PITO', u'POPO', u'PUTA', u'PUTO', u'QULO', u'RATA', u'ROBA', u'ROBE', u'ROBO', u'RUIN', u'SENO', u'TETA', u'VACA', u'VAGA', u'VAGO', u'VAKA', u'VUEI', u'VUEY', u'WUEI', u'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.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=9, 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 = [u'BUEI', u'BUEY', u'CACA', u'CACO', u'CAGA', u'CAGO', u'CAKA', u'CAKO', u'COGE', u'COJA', u'COJE', u'COJI', u'COJO', u'CULO', u'FETO', u'GUEY', u'JOTO', u'KACA', u'KACO', u'KAGA', u'KAGO', u'KOGE', u'KOJO', u'KAKA', u'KULO', u'MAME', u'MAMO', u'MEAR', u'MEAS', u'MEON', u'MION', u'MOCO', u'MULA', u'PEDA', u'PEDO', u'PENE', u'PUTA', u'PUTO', u'QULO', u'RATA', u'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.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 = ((u'AGU', <django.utils.functional.__proxy__ object at 0x7f9540ba5d10>), (u'BCN', <django.utils.functional.__proxy__ object at 0x7f9540ba5d50>), (u'BCS', <django.utils.functional.__proxy__ object at 0x7f9540ba5dd0>), (u'CAM', <django.utils.functional.__proxy__ object at 0x7f9540ba5e50>), (u'CHH', <django.utils.functional.__proxy__ object at 0x7f9540ba5ed0>), (u'CHP', <django.utils.functional.__proxy__ object at 0x7f9540ba5f50>), (u'COA', <django.utils.functional.__proxy__ object at 0x7f9540ba5fd0>), (u'COL', <django.utils.functional.__proxy__ object at 0x7f9540bbf090>), (u'DIF', <django.utils.functional.__proxy__ object at 0x7f9540bbf110>), (u'DUR', <django.utils.functional.__proxy__ object at 0x7f9540bbf190>), (u'GRO', <django.utils.functional.__proxy__ object at 0x7f9540bbf210>), (u'GUA', <django.utils.functional.__proxy__ object at 0x7f9540bbf290>), (u'HID', <django.utils.functional.__proxy__ object at 0x7f9540bbf310>), (u'JAL', <django.utils.functional.__proxy__ object at 0x7f9540bbf390>), (u'MEX', <django.utils.functional.__proxy__ object at 0x7f9540bbf410>), (u'MIC', <django.utils.functional.__proxy__ object at 0x7f9540bbf490>), (u'MOR', <django.utils.functional.__proxy__ object at 0x7f9540bbf510>), (u'NAY', <django.utils.functional.__proxy__ object at 0x7f9540bbf590>), (u'NLE', <django.utils.functional.__proxy__ object at 0x7f9540bbf610>), (u'OAX', <django.utils.functional.__proxy__ object at 0x7f9540bbf690>), (u'PUE', <django.utils.functional.__proxy__ object at 0x7f9540bbf710>), (u'QUE', <django.utils.functional.__proxy__ object at 0x7f9540bbf790>), (u'ROO', <django.utils.functional.__proxy__ object at 0x7f9540bbf810>), (u'SIN', <django.utils.functional.__proxy__ object at 0x7f9540bbf890>), (u'SLP', <django.utils.functional.__proxy__ object at 0x7f9540bbf910>), (u'SON', <django.utils.functional.__proxy__ object at 0x7f9540bbf990>), (u'TAB', <django.utils.functional.__proxy__ object at 0x7f9540bbfa10>), (u'TAM', <django.utils.functional.__proxy__ object at 0x7f9540bbfa90>), (u'TLA', <django.utils.functional.__proxy__ object at 0x7f9540bbfb10>), (u'VER', <django.utils.functional.__proxy__ object at 0x7f9540bbfb90>), (u'YUC', <django.utils.functional.__proxy__ object at 0x7f9540bbfc10>), (u'ZAC', <django.utils.functional.__proxy__ object at 0x7f9540bbfc90>))

All 31 states, plus the Distrito Federal.