Switzerland (ch)

Forms

Swiss-specific Form helpers

class localflavor.ch.forms.CHIdentityCardNumberField(required=True, widget=None, label=None, initial=None, help_text=u'', error_messages=None, show_hidden_initial=False, validators=[], localize=False)[source]

A Swiss identity card number.

Checks the following rules to determine whether the number is valid:

  • Conforms to the X1234567<0 or 1234567890 format.
  • Included checksums match calculated checksums
class localflavor.ch.forms.CHPhoneNumberField(required=True, widget=None, label=None, initial=None, help_text=u'', error_messages=None, show_hidden_initial=False, validators=[], localize=False)[source]

Validate local Swiss phone number (not international ones) The correct format is ‘0XX XXX XX XX’. ‘0XX.XXX.XX.XX’ and ‘0XXXXXXXXX’ validate but are corrected to ‘0XX XXX XX XX’.

class localflavor.ch.forms.CHStateSelect(attrs=None)[source]

A Select widget that uses a list of CH states as its choices.

class localflavor.ch.forms.CHZipCodeField(max_length=None, min_length=None, *args, **kwargs)[source]

A form field that validates input as a Swiss zip code. Valid codes consist of four digits.

Data

localflavor.ch.ch_states.STATE_CHOICES = (('AG', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1610>), ('AI', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1650>), ('AR', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1690>), ('BS', <django.utils.functional.__proxy__ object at 0x7f1e9e1e16d0>), ('BL', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1710>), ('BE', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1750>), ('FR', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1790>), ('GE', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1810>), ('GL', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1890>), ('GR', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1910>), ('JU', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1990>), ('LU', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1a10>), ('NE', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1a90>), ('NW', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1b10>), ('OW', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1b90>), ('SH', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1c10>), ('SZ', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1c90>), ('SO', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1d10>), ('SG', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1d90>), ('TG', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1e10>), ('TI', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1e90>), ('UR', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1f10>), ('VS', <django.utils.functional.__proxy__ object at 0x7f1e9e1e1f90>), ('VD', <django.utils.functional.__proxy__ object at 0x7f1e9e265050>), ('ZG', <django.utils.functional.__proxy__ object at 0x7f1e9e2650d0>), ('ZH', <django.utils.functional.__proxy__ object at 0x7f1e9e265150>))

An alphabetical list of states