Ukraine (ua)

Forms

class localflavor.ua.forms.UAPostalCodeField(*args, **kwargs)[source]

A form field that validates input as a Ukrainian postal code.

Valid format is XXXXX. Note: first two numbers cannot be ‘00’.

Whitespace around a postal code is accepted and automatically trimmed.

New in version 1.5.

to_python(value)[source]

Return a string.

class localflavor.ua.forms.UARegionSelect(*args, **kwargs)[source]

A Select widget that uses a list of Ukrainian regions as its choices.

New in version 1.5.

class localflavor.ua.forms.UAVatNumberField(*args, **kwargs)[source]

A form field that validates input as a Ukrainian analog of a VAT number.

Valid format is XXXXXXXXXX.

Whitespace around a VAT number is accepted and automatically trimmed.

New in version 1.5.

to_python(value)[source]

Return a string.

Models

class localflavor.ua.models.UAPostalCodeField(*args, **kwargs)[source]

A model field which stores a Ukrainian postal code.

This field is represented by forms as a UAPostalCodeField field.

New in version 1.5.

class localflavor.ua.models.UARegionField(*args, **kwargs)[source]

A model field which stores a Ukrainian region.

This field is represented by forms as a UARegionSelect field.

New in version 1.5.

deconstruct()[source]

Return enough information to recreate the field as a 4-tuple:

  • The name of the field on the model, if contribute_to_class() has been run.
  • The import path of the field, including the class:e.g. django.db.models.IntegerField This should be the most portable version, so less specific may be better.
  • A list of positional arguments.
  • A dict of keyword arguments.

Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):

  • None, bool, str, int, float, complex, set, frozenset, list, tuple, dict
  • UUID
  • datetime.datetime (naive), datetime.date
  • top-level classes, top-level functions - will be referenced by their full import path
  • Storage instances - these have their own deconstruct() method

This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.

There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.

class localflavor.ua.models.UAVatNumberField(*args, **kwargs)[source]

A model field which stores a Ukrainian analog of a VAT number.

This field is represented by forms as a UAVatNumberField field.

New in version 1.5.

Data

localflavor.ua.ua_regions.UA_REGION_CHOICES = (('UA-71', 'Cherkasy Oblast'), ('UA-74', 'Chernihiv Oblast'), ('UA-77', 'Chernivtsi Oblast'), ('UA-12', 'Dnipropetrovsk Oblast'), ('UA-14', 'Donetsk Oblast'), ('UA-26', 'Ivano-Frankivsk Oblast'), ('UA-63', 'Kharkiv Oblast'), ('UA-65', 'Kherson Oblast'), ('UA-68', 'Khmelnytskyi Oblast'), ('UA-35', 'Kirovohrad Oblast'), ('UA-32', 'Kiev Oblast'), ('UA-09', 'Luhansk Oblast'), ('UA-46', 'Lviv Oblast'), ('UA-48', 'Mykolaiv Oblast'), ('UA-51', 'Odessa Oblast'), ('UA-53', 'Poltava Oblast'), ('UA-56', 'Rivne Oblast'), ('UA-59', 'Sumy Oblast'), ('UA-61', 'Ternopil Oblast'), ('UA-05', 'Vinnytsia Oblast'), ('UA-07', 'Volyn Oblast'), ('UA-21', 'Zakarpattia Oblast'), ('UA-23', 'Zaporizhia Oblast'), ('UA-18', 'Zhytomyr Oblast'), ('UA-43', 'Autonomous Republic of Crimea'), ('UA-30', 'Kiev'), ('UA-40', 'Sevastopol'))

tuple() -> empty tuple tuple(iterable) -> tuple initialized from iterable’s items

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