Norway (no)

Forms

Norwegian-specific Form helpers.

class localflavor.no.forms.NOBankAccountNumber(max_length=None, min_length=None, strip=True, *args, **kwargs)[source]

A form field for Norwegian bank account numbers.

Performs MOD11 with the custom weights for the Norwegian bank account numbers, including a check for a remainder of 0, in which event the checksum is also 0.

Usually their string representation is along the lines of ZZZZ.YY.XXXXX, where the last X is the check digit. They’re always a total of 11 digits long, with 10 out of these 11 being the actual account number itself.

  • Accepts, and strips, account numbers with extra spaces.
  • Accepts, and strips, account numbers provided in form of XXXX.YY.XXXXX.

Note

No consideration is taking for banking clearing numbers as of yet, seeing as these are only used between banks themselves.

New in version 1.5.

class localflavor.no.forms.NOMunicipalitySelect(attrs=None)[source]

A Select widget that uses a list of Norwegian municipalities (fylker) as its choices.

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

Field with phonenumber validation.

Requires a phone number with 8 digits and optional country code

class localflavor.no.forms.NOSocialSecurityNumber(required=True, widget=None, label=None, initial=None, help_text='', error_messages=None, show_hidden_initial=False, validators=[], localize=False, disabled=False, label_suffix=None)[source]

Algorithm is documented at http://no.wikipedia.org/wiki/Personnummer.

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

A form field that validates input as a Norwegian zip code.

Valid codes have four digits.

Data

localflavor.no.no_municipalities.MUNICIPALITY_CHOICES = (('akershus', 'Akershus'), ('austagder', 'Aust-Agder'), ('buskerud', 'Buskerud'), ('finnmark', 'Finnmark'), ('hedmark', 'Hedmark'), ('hordaland', 'Hordaland'), ('janmayen', 'Jan Mayen'), ('moreogromsdal', 'Møre og Romsdal'), ('nordtrondelag', 'Nord-Trøndelag'), ('nordland', 'Nordland'), ('oppland', 'Oppland'), ('oslo', 'Oslo'), ('rogaland', 'Rogaland'), ('sognogfjordane', 'Sogn og Fjordane'), ('svalbard', 'Svalbard'), ('sortrondelag', 'Sør-Trøndelag'), ('telemark', 'Telemark'), ('troms', 'Troms'), ('vestagder', 'Vest-Agder'), ('vestfold', 'Vestfold'), ('ostfold', 'Østfold'))

An alphabetical list of Norwegian municipalities (fylker) for use as choices in a formfield.