Kuwait (kw)

Forms

Kuwait-specific Form helpers.

class localflavor.kw.forms.KWAreaSelect(attrs=None)[source]

A Select widget that uses a list of Kuwait areas as its choices.

Added in version 1.6.

class localflavor.kw.forms.KWCivilIDNumberField(max_length=12, min_length=12, **kwargs)[source]

Kuwaiti Civil ID numbers are 12 digits, second to seventh digits represents the person’s birthdate.

Checks the following rules to determine the validity of the number:
  • The number consist of 12 digits.

  • The first(century) digit should be 1, 2, or 3.

  • The birthdate of the person is a valid date.

  • The calculated checksum equals to the last digit of the Civil ID.

clean(value)[source]

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

class localflavor.kw.forms.KWGovernorateSelect(attrs=None)[source]

A Select widget that uses a list of Kuwait governorates as its choices.

localflavor.kw.forms.is_valid_kw_civilid_checksum(value)[source]

Deprecated since version 5.0: Use localflavor.kw.utils.is_valid_civil_id() instead.

Utilities

localflavor.kw.utils.get_birthdate_from_civil_id(cid)[source]

Extracts the birthdate from a Kuwaiti Civil ID number

localflavor.kw.utils.is_valid_civil_id(cid)[source]

Checks the validity of a Kuwaiti Civil ID number by verifying the following:

  • The number should consist of 12 digits

  • The first digit should be 1, 2, or 3

  • The extracted birthdate should be a valid date

  • The checksum should be equal to the last digit of the Civil ID

Data

localflavor.kw.kw_areas.AREA_CHOICES = (('Kuwait City', (('AS', 'Abdullah Al-Salem'), ('AD', 'Adailiya'), ('BQ', 'Bneid Al Qar'), ('DY', 'Daiya'), ('DS', 'Dasma'), ('DN', 'Dasman'), ('DH', 'Doha'), ('FH', 'Faiha'), ('GR', 'Granada'), ('JA', 'Jaber Al Ahmad'), ('JB', 'Jibla'), ('KF', 'Kaifan'), ('KH', 'Khaldiya'), ('KC', 'Kuwait City'), ('KZ', 'Kuwait Free Trade Zone'), ('MS', 'Mansouriya'), ('MR', 'Mirqab'), ('MC', 'Mubarekiya Camps'), ('NT', 'Nahdha'), ('NS', 'North West Al-Sulaibikhat'), ('NZ', 'Nuzha'), ('QD', 'Qadsiya'), ('QA', 'Qairawan'), ('QT', 'Qortuba'), ('RW', 'Rawda'), ('SH', 'Salhiya'), ('SM', 'Shamiya'), ('SQ', 'Sharq'), ('SA', 'Shuwaikh Administrative'), ('SI', 'Shuwaikh Industrial'), ('SR', 'Shuwaikh Residential'), ('ST', 'Sulaibikhat'), ('SU', 'Surra'), ('YR', 'Yarmouk'))), ('Farwaniya', (('AB', 'Abbasiya'), ('AM', 'Abdullah Al Mubarak Al Sabah'), ('AK', 'Abraq Khaitan'), ('DJ', 'Al-Dajeej'), ('SD', 'Al-Shadadiya'), ('AN', 'Andalous'), ('AR', 'Ardiya'), ('AI', 'Ardiya Small Industrial'), ('AZ', 'Ardiya Storage Zone'), ('FR', 'Farwaniya'), ('FD', 'Firdous'), ('IS', 'Ishbiliya'), ('JS', 'Jeleeb Al-Shuyoukh'), ('KT', 'Khaitan'), ('OM', 'Omariya'), ('RA', 'Rabia'), ('RI', 'Rai'), ('RH', 'Rehab'), ('RG', 'Rigai'), ('SN', 'Sabah Al Nasser'), ('SK', 'South Khaitan - Exhibits'))), ('Mubarak Al Kabir', (('AH', 'Abu Al Hasaniya'), ('AF', 'Abu Fatira'), ('AA', 'Adan'), ('MS', 'Al-Masayel'), ('CS', 'Coast Strip B'), ('FN', 'Fnaitees'), ('ME', 'Messila'), ('MK', 'Mubarak Al Kabeer'), ('QU', 'Qurain'), ('QS', 'Qusor'), ('SS', 'Sabah Al Salem'), ('SL', 'Sabhan Industrial Area'), ('SW', 'South Wista'), ('WA', 'West Abu Fatira Small Industrial'))), ('Hawally', (('AQ', 'Al-Siddeeq'), ('AJ', 'Anjafa'), ('BY', 'Bayan'), ('HT', 'Hateen'), ('HW', 'Hawally'), ('JR', 'Jabriya'), ('MH', 'Maidan Hawally'), ('MI', 'Mishref'), ('MA', 'Mubarak Al-Abdullah'), ('RU', 'Rumaithiya'), ('AL', 'Al-Salam'), ('SY', 'Salmiya'), ('LW', 'Salwa'), ('SB', 'Shaab'), ('DA', 'Shuhada'), ('ZH', 'Zahra'))), ('Ahmadi', (('BH', 'Abu Halifa'), ('MD', 'Ahmadi'), ('KI', 'Al Khiran'), ('AW', 'Al Wafrah'), ('JU', "Al-Julaia_'a"), ('NU', 'Al-Nuwaiseeb'), ('RQ', 'Al-Riqqa'), ('SE', 'Ali Sabah Al Salem'), ('HI', 'Assabahiyah'), ('BN', 'Bnaider'), ('DR', 'Dahar'), ('EQ', 'Eqaila'), ('FA', 'Fahad Al Ahmad'), ('FE', 'Fahaheel'), ('FI', 'Fintas'), ('HD', 'Hadiya'), ('JI', 'Jaber Al Ali'), ('MB', 'Mahboula'), ('MG', 'Mangaf'), ('BA', 'Sabah Al Ahmad'), ('DU', 'Al Dubaiya'), ('MU', 'Mina Abdullah'), ('HU', 'Shuaiba Block 1'), ('WI', 'West Industrial Shuaiba'), ('ZR', 'Zour'))), ('Jahra', (('S1', 'Al Sulaibiya Industrial 1'), ('S2', 'Al Sulaibiya Industrial 2'), ('IA', 'Amgarah Industrial Area'), ('JH', 'Jahra'), ('NA', 'Naeem'), ('NM', 'Naseem'), ('OY', 'Oyoun'), ('QR', 'Qasr'), ('BD', 'Saad Al Abdullah'), ('S0', 'Sulaibiya'), ('TA', "Taima'"), ('WH', 'Waha'))))

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

localflavor.kw.kw_governorates.GOVERNORATE_CHOICES = (('AH', 'Ahmadi'), ('FA', 'Farwaniyah'), ('JA', 'Jahra'), ('KU', 'Capital'), ('HA', 'Hawalli'), ('MU', 'Mubarak Al Kabir'))

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.