New Zealand (nz)

New in version 1.1.

Forms

New Zealand specific form helpers.

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

A form field that validates its input as New Zealand bank account number.

Formats:

XX-XXXX-XXXXXXX-XX

XX-XXXX-XXXXXXX-XXX

Where:

  • the first two digits is the bank ID
  • the next four digits are the branch number where the account was opened
  • the next 7 digits are the account numbers
  • the last two or three digits define type of the account.
clean(value)[source]

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

class localflavor.nz.forms.NZNorthIslandCouncilSelect(attrs=None)[source]

A select widget with list of New Zealand North Island city and district councils as its choices.

class localflavor.nz.forms.NZPostCodeField(**kwargs)[source]

A form field that validates its input as New Zealand postal code.

class localflavor.nz.forms.NZProvinceSelect(attrs=None)[source]

A select widget with list of New Zealand provinces as its choices.

class localflavor.nz.forms.NZRegionSelect(attrs=None)[source]

A select widget with list of New Zealand regions as its choices.

class localflavor.nz.forms.NZSouthIslandCouncilSelect(attrs=None)[source]

A select widget with list of New Zealand South Island city and district councils as its choices.

Data

localflavor.nz.nz_regions.REGION_CHOICES = (('NZ-NTL', 'Northland'), ('NZ-AUK', 'Auckland'), ('NZ-WKO', 'Waikato'), ('NZ-BOP', 'Bay of Plenty'), ('NZ-GIS', 'Gisborne'), ('NZ-HKB', "Hawke's Bay"), ('NZ-TKI', 'Taranaki'), ('NZ-MWT', 'Manawatu-Wanganui'), ('NZ-WGN', 'Wellington'), ('NZ-TAS', 'Tasman'), ('NZ-NSN', 'Nelson'), ('NZ-MBH', 'Marlborough'), ('NZ-WTC', 'West Coast'), ('NZ-CAN', 'Canterbury'), ('NZ-OTA', 'Otago'), ('NZ-STL', 'Southland'))

A list of regions

localflavor.nz.nz_provinces.PROVINCE_CHOICES = (('Auckland', 'Auckland'), ('Taranaki', 'Taranaki'), ("Hawke's Bay", "Hawke's Bay"), ('Wellington', 'Wellington'), ('Marlborough', 'Marlborough'), ('Nelson', 'Nelson'), ('Canterbury', 'Canterbury'), ('South Canterbury', 'South Canterbury'), ('Westland', 'Westland'), ('Otago', 'Otago'), ('Southland', 'Southland'), ('Chatham Islands', 'Chatham Islands'))

A list of provinces (abolished in 1876, use regions instead)

localflavor.nz.nz_councils.NORTH_ISLAND_COUNCIL_CHOICES = (('Far North', 'Far North District'), ('Whangarei', 'Whangarei District'), ('Kaipara', 'Kaipara District'), ('Auckland', 'Auckland'), ('Thames-Coromandel', 'Thames-Coromandel District'), ('Hauraki', 'Hauraki District'), ('Waikato', 'Waikato District'), ('Matamata-Piako', 'Matamata-Piako District'), ('Hamilton', 'Hamilton'), ('Waipa', 'Waipa District'), ('South Waikato', 'South Waikato District'), ('Otorohanga', 'Otorohanga District'), ('Waitomo', 'Waitomo District'), ('Taupo', 'Taupo District'), ('Western Bay of Plenty', 'Western Bay of Plenty District'), ('Tauranga', 'Tauranga'), ('Opotiki', 'Opotiki District'), ('Whakatane', 'Whakatane District'), ('Rotorua\t', 'Rotorua District'), ('Kawerau', 'Kawerau District'), ('Gisborne', 'Gisborne District'), ('Wairoa', 'Wairoa District'), ('Hastings', 'Hastings District'), ('Napier', 'Napier'), ("Central Hawke's Bay", "Central Hawke's Bay District"), ('New Plymouth', 'New Plymouth District'), ('Stratford', 'Stratford District'), ('South Taranaki', 'South Taranaki District'), ('Ruapehu', 'Ruapehu District'), ('Rangitikei', 'Rangitikei District'), ('Wanganui', 'Wanganui District'), ('Manawatu', 'Manawatu District'), ('Palmerston North', 'Palmerston North'), ('Tararua', 'Tararua District'), ('Horowhenua', 'Horowhenua District'), ('Masterton', 'Masterton District'), ('Kapiti Coast', 'Kapiti Coast District'), ('Carterton', 'Carterton District'), ('South Wairarapa', 'South Wairarapa District'), ('Upper Hutt', 'Upper Hutt'), ('Porirua', 'Porirua'), ('Hutt', 'Hutt'), ('Wellington', 'Wellington'))

A list of North Island city and district councils

localflavor.nz.nz_councils.SOUTH_ISLAND_COUNCIL_CHOICES = (('Tasman', 'Tasman District'), ('Nelson', 'Nelson'), ('Marlborough', 'Marlborough District'), ('Buller', 'Buller District'), ('Grey', 'Grey District'), ('Westland', 'Westland District'), ('Kaikoura', 'Kaikoura District'), ('Hurunui', 'Hurunui District'), ('Selwyn', 'Selwyn District'), ('Waimakariri', 'Waimakariri District'), ('Christchurch', 'Christchurch'), ('Ashburton', 'Ashburton District'), ('Mackenzie', 'Mackenzie District'), ('Timaru', 'Timaru District'), ('Waimate', 'Waimate District'), ('Waitaki', 'Waitaki District'), ('Queenstown-Lakes', 'Queenstown-Lakes District'), ('Central Otago', 'Central Otago District'), ('Dunedin', 'Dunedin'), ('Clutha', 'Clutha District'), ('Southland', 'Southland District'), ('Gore', 'Gore District'), ('Invercargill', 'Invercargill'))

A list of South Island city and district councils