fairdm.db.fields#

Model fields that store quantities and partial dates.

Module Contents#

Classes#

BigIntegerQuantityField

A quantity field storing big integer values.

DecimalQuantityField

A quantity field storing decimal values.

IntegerQuantityField

A quantity field storing integer values.

PositiveIntegerQuantityField

A quantity field storing positive integer values.

QuantityField

A quantity field storing float values.

PartialDateField

A date field that accepts a year, a year and month, or a full date.

API#

class BigIntegerQuantityField(base_units: str, *args, unit_choices: Iterable[str] | None = None, **kwargs)[source]#

Bases: quantityfield.fields.BigIntegerQuantityField

A quantity field storing big integer values.

Initialization

Create a Quantity field :param base_units: Unit description of base unit :param unit_choices: If given the possible unit choices with the same dimension like the base_unit

form_field_class#

None

to_number_type#

None

class DecimalQuantityField(base_units: str, *args, unit_choices: list[str] | None = None, verbose_name: str = None, name: str = None, max_digits: int = None, decimal_places: int = None, **kwargs)[source]#

Bases: quantityfield.fields.DecimalQuantityField

A quantity field storing decimal values.

Initialization

Create a Quantity field :param base_units: Unit description of base unit :param unit_choices: If given the possible unit choices with the same dimension like the base_unit

form_field_class#

None

to_number_type#

None

class IntegerQuantityField(base_units: str, *args, unit_choices: Iterable[str] | None = None, **kwargs)[source]#

Bases: quantityfield.fields.IntegerQuantityField

A quantity field storing integer values.

Initialization

Create a Quantity field :param base_units: Unit description of base unit :param unit_choices: If given the possible unit choices with the same dimension like the base_unit

form_field_class#

None

to_number_type#

None

class PositiveIntegerQuantityField(base_units: str, *args, unit_choices: Iterable[str] | None = None, **kwargs)[source]#

Bases: quantityfield.fields.PositiveIntegerQuantityField

A quantity field storing positive integer values.

Initialization

Create a Quantity field :param base_units: Unit description of base unit :param unit_choices: If given the possible unit choices with the same dimension like the base_unit

form_field_class#

None

to_number_type#

None

class QuantityField(base_units: str, *args, unit_choices: Iterable[str] | None = None, **kwargs)[source]#

Bases: quantityfield.fields.QuantityField

A quantity field storing float values.

Initialization

Create a Quantity field :param base_units: Unit description of base unit :param unit_choices: If given the possible unit choices with the same dimension like the base_unit

form_field_class#

None

to_number_type#

None

class PartialDateField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=NOT_PROVIDED, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=(), error_messages=None, db_comment=None, db_default=NOT_PROVIDED)[source]#

Bases: partial_date.PartialDateField

A date field that accepts a year, a year and month, or a full date.

Initialization

formfield(**kwargs)[source]#

Return FairDM’s partial-date form field.