India (in)

Forms

India-specific Form helpers.

class localflavor.in_.forms.INPhoneNumberField(max_length=None, min_length=None, *args, **kwargs)[source]

INPhoneNumberField validates that the data is a valid Indian phone number, including the STD code. It’s normalised to 0XXX-XXXXXXX or 0XXX XXXXXXX format. The first string is the STD code which is a ‘0’ followed by 2-4 digits. The second string is 8 digits if the STD code is 3 digits, 7 digits if the STD code is 4 digits and 6 digits if the STD code is 5 digits. The second string will start with numbers between 1 and 6. The separator is either a space or a hyphen.

class localflavor.in_.forms.INStateField(required=True, widget=None, label=None, initial=None, help_text=None, error_messages=None, show_hidden_initial=False, validators=[], localize=False)[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

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

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

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

Normalized state names

Table Of Contents

Previous topic

Israel (il)

Next topic

Iceland (is)

This Page