Pakistan (pk)

Forms

Pakistani-specific Form helpers.

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

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

Valid numbers have nine to eleven digits.

Deprecated since version 1.4: Use the django-phonenumber-field library instead.

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).

Deprecated since version 1.4: Use the django-phonenumber-field library instead.

description = '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 = '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 = 'Pakistani State'

Data

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

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