fairdm.db.fields#
Model fields that store quantities and partial dates.
Module Contents#
Classes#
A quantity field storing big integer values. |
|
A quantity field storing decimal values. |
|
A quantity field storing integer values. |
|
A quantity field storing positive integer values. |
|
A quantity field storing float values. |
|
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.BigIntegerQuantityFieldA 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.DecimalQuantityFieldA 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.IntegerQuantityFieldA 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.PositiveIntegerQuantityFieldA 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.QuantityFieldA 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.PartialDateFieldA date field that accepts a year, a year and month, or a full date.
Initialization