Pakistan (pk)

Forms

Pakistani-specific Form helpers.

class localflavor.pk.forms.PKPhoneNumberField(max_length=None, min_length=None, strip=True, empty_value=u”, *args, **kwargs)[source]

A form field that validates input as an Pakistani phone number.

Valid numbers have nine to eleven digits.

clean(value)[source]

Validate a phone number.

Strips parentheses, whitespace and hyphens.

class localflavor.pk.forms.PKPostCodeField(*args, **kwargs)[source]

Pakistani post code field.

Assumed to be 5 digits.

class localflavor.pk.forms.PKStateSelect(attrs=None)[source]

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

Models

class localflavor.pk.models.PKPhoneNumberField(*args, **kwargs)[source]

A model field that checks that the value is a valid Pakistani phone number (nine to eleven digits).

description = u’Pakistani Phone number’
formfield(**kwargs)[source]
class localflavor.pk.models.PKPostCodeField(*args, **kwargs)[source]

A model field that stores the five-digit Pakistani postcode in the database

Forms represent it as a PKPostCodeField field.

description = u’Pakistani Postcode’
formfield(**kwargs)[source]
class localflavor.pk.models.PKStateField(*args, **kwargs)[source]

A model field that stores the five-letter Pakistani state abbreviation in the database.

It is represented with STATE_CHOICES` choices.

deconstruct()[source]
description = u’Pakistani State’

Data

localflavor.pk.pk_states.STATE_CHOICES = ((‘PK-JK’, u’Azad Jammu & Kashmir’), (‘PK-BA’, u’Balochistan’), (‘PK-TA’, u’Federally Administered Tribal Areas’), (‘PK-GB’, u’Gilgit-Baltistan’), (‘PK-IS’, u’Islamabad’), (‘PK-KP’, u’Khyber Pakhtunkhwa’), (‘PK-PB’, u’Punjab’), (‘PK-SD’, u’Sindh’))

An alphabetical list of states for use as choices in a formfield.