South Africa (za)

Forms

South Africa-specific Form helpers.

class localflavor.za.forms.ZAIDField(*, max_length=None, min_length=None, strip=True, empty_value='', **kwargs)[source]

A form field for South African ID numbers.

The checksum is validated using the Luhn checksum, and uses a simplistic (read: not entirely accurate) check for the birth date.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class localflavor.za.forms.ZAPostCodeField(**kwargs)[source]

A form field that validates input as a South African postcode.

Valid postcodes must have four digits.

class localflavor.za.forms.ZAProvinceSelect(attrs=None)[source]

A Select widget that uses a list of South African Provinces as its choices.

Data

localflavor.za.za_provinces.PROVINCE_CHOICES = (('EC', 'Eastern Cape'), ('FS', 'Free State'), ('GP', 'Gauteng'), ('KN', 'KwaZulu-Natal'), ('LP', 'Limpopo'), ('MP', 'Mpumalanga'), ('NC', 'Northern Cape'), ('NW', 'North West'), ('WC', 'Western Cape'))

A list of South African provinces as choices in a formfield.