India (in)

Forms

India-specific Form helpers.

class localflavor.in_.forms.INAadhaarNumberField(*, 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 for Aadhaar number issued by Unique Identification Authority of India (UIDAI).

Checks the following rules to determine whether the number is valid:

  • Conforms to the XXXX XXXX XXXX format.
  • No group consists entirely of zeroes.

Important information:

  • Aadhaar number is a proof of identity but not of citizenship.
  • Aadhaar number is issued to every resident of India including foreign citizens.
  • Aadhaar number is not mandatory.

More information can be found at http://uidai.gov.in/what-is-aadhaar-number.html

class localflavor.in_.forms.INStateField(*, 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 its input is a Indian state name or abbreviation.

It normalizes the input to the standard two-letter vehicle registration abbreviation for the given state or union territory

Changed in version 1.1: Added Telangana to list of states. More details at https://en.wikipedia.org/wiki/Telangana#Bifurcation_of_Andhra_Pradesh

class localflavor.in_.forms.INStateSelect(attrs=None)[source]

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

Changed in version 1.1: Added Telangana to list of states. More details at https://en.wikipedia.org/wiki/Telangana#Bifurcation_of_Andhra_Pradesh

class localflavor.in_.forms.INZipCodeField(*args, **kwargs)[source]

A form field that validates input as an Indian zip code, with the format XXXXXXX.

Data

localflavor.in_.in_states.STATE_CHOICES = (('KA', 'Karnataka'), ('AP', 'Andhra Pradesh'), ('KL', 'Kerala'), ('TN', 'Tamil Nadu'), ('MH', 'Maharashtra'), ('UP', 'Uttar Pradesh'), ('GA', 'Goa'), ('GJ', 'Gujarat'), ('RJ', 'Rajasthan'), ('HP', 'Himachal Pradesh'), ('JK', 'Jammu and Kashmir'), ('TG', 'Telangana'), ('AR', 'Arunachal Pradesh'), ('AS', 'Assam'), ('BR', 'Bihar'), ('CG', 'Chattisgarh'), ('HR', 'Haryana'), ('JH', 'Jharkhand'), ('MP', 'Madhya Pradesh'), ('MN', 'Manipur'), ('ML', 'Meghalaya'), ('MZ', 'Mizoram'), ('NL', 'Nagaland'), ('OR', 'Orissa'), ('PB', 'Punjab'), ('SK', 'Sikkim'), ('TR', 'Tripura'), ('UA', 'Uttarakhand'), ('WB', 'West Bengal'), ('AN', 'Andaman and Nicobar'), ('CH', 'Chandigarh'), ('DN', 'Dadra and Nagar Haveli'), ('DD', 'Daman and Diu'), ('DL', 'Delhi'), ('LD', 'Lakshadweep'), ('PY', 'Pondicherry'))

A list of states

localflavor.in_.in_states.STATES_NORMALIZED = {'arunachal pradesh': 'AR', 'tamilnadu': 'TN', 'punjab': 'PB', 'mp': 'MP', 'chattisgarh': 'CG', 'lakshadweep': 'LD', 'andaman and nicobar': 'AN', 'karnataka': 'KA', 'as': 'AS', 'west bengal': 'WB', 'goa': 'GA', 'ar': 'AR', 'westbengal': 'WB', 'wb': 'WB', 'ka': 'KA', 'br': 'BR', 'tr': 'TR', 'ap': 'AP', 'py': 'PY', 'jammu and kashmir': 'JK', 'madhya pradesh': 'MP', 'dl': 'DL', 'mizo': 'MZ', 'dn': 'DN', 'ch': 'CH', 'manipur': 'MN', 'sk': 'SK', 'rajastan': 'RJ', 'andhrapradesh': 'AP', 'tamilnad': 'TN', 'mn': 'MN', 'tn': 'TN', 'nagaland': 'NL', 'mh': 'MH', 'an': 'AN', 'meghalaya': 'ML', 'tg': 'TG', 'rajasthan': 'RJ', 'pb': 'PB', 'assam': 'AS', 'daman and diu': 'DD', 'or': 'OR', 'himachal pradesh': 'HP', 'uttarakhand': 'UA', 'ga': 'GA', 'dadra and nagar haveli': 'DN', 'tamil nadu': 'TN', 'hp': 'HP', 'mizoram': 'MZ', 'dd': 'DD', 'mz': 'MZ', 'rj': 'RJ', 'orisa': 'OR', 'ua': 'UA', 'ml': 'ML', 'bengal': 'WB', 'haryana': 'HR', 'gj': 'GJ', 'delhi': 'DL', 'jharkhand': 'JH', 'odisa': 'OR', 'up': 'UP', 'jh': 'JH', 'nl': 'NL', 'tripura': 'TR', 'cg': 'CG', 'karnatka': 'KA', 'kerala': 'KL', 'chandigarh': 'CH', 'jk': 'JK', 'uttar pradesh': 'UP', 'andhra pradesh': 'AP', 'telangana': 'TG', 'pondicherry': 'PY', 'ld': 'LD', 'hr': 'HR', 'andra pradesh': 'AP', 'bihar': 'BR', 'sikkim': 'SK', 'kl': 'KL', 'gujarat': 'GJ', 'maharastra': 'MH', 'andrapradesh': 'AP', 'orissa': 'OR', 'maharashtra': 'MH'}

Normalized state names