2
# ZAIDField #################################################################
4
ZAIDField validates that the date is a valid birthdate and that the value
5
has a valid checksum. It allows spaces and dashes, and returns a plain
7
>>> from django.contrib.localflavor.za.forms import ZAIDField
9
>>> f.clean('0002290001003')
11
>>> f.clean('000229 0001 003')
13
>>> f.clean('0102290001001')
14
Traceback (most recent call last):
16
ValidationError: [u'Enter a valid South African ID number']
18
Traceback (most recent call last):
20
ValidationError: [u'Enter a valid South African ID number']
21
>>> f.clean('0002290001004')
22
Traceback (most recent call last):
24
ValidationError: [u'Enter a valid South African ID number']
26
# ZAPostCodeField ###########################################################
27
>>> from django.contrib.localflavor.za.forms import ZAPostCodeField
28
>>> f = ZAPostCodeField()
30
Traceback (most recent call last):
32
ValidationError: [u'Enter a valid South African postal code']
36
Traceback (most recent call last):
38
ValidationError: [u'Enter a valid South African postal code']