BloomERP

Built-ins

FieldTypeDefinition

Connect a Django field class to its Bloomerp editors, renderers, and lookups.

Use a stable definition ID in application field metadata. A symbolic lookup alias lets Python code retrieve the same registered definition.

SettingTypeDefaultDescription
idstrRequiredStable field type ID stored in application field metadata.
documentationstr''Markdown and tagged examples included in the generated developer reference.
labelstrRequiredDisplay name of the field type.
descriptionstr | NoneNoneSummary of the values this field type represents.
iconstr'fa-solid fa-table-columns'Icon used in the field picker.
model_field_clstype[Field] | NoneNoneDjango field class associated with this type.
constructionFieldConstruction | NoneNoneConstructor defaults and options used by the model builder.
batch_value_loaderOptional[Callable[[Sequence[Model], Sequence[Any]], NoneType]]NoneCallback that preloads field values for a group of records.
widget_factoryOptional[Callable[[FieldContext], Widget]]NoneCallback that builds the field's editor widget.
form_factoryOptional[Callable[[FieldContext, Field | None], Field | None]]NoneCallback that builds or updates the Django form field.
render_valueCallable[[Any, Model], Any]_render_field_valueCallback that formats a value for display.
lookupstuple[LookupDefinition | BoundLookup, ...]()Filter operators enabled for this field type.
display_optionsOptional[Callable[[Any], tuple[FieldDisplayOption, ...]]]NoneCallback that lists display options for an application field.

Register a field for warehouse codes

Create a distinct Django field subclass so Bloomerp can resolve the field type by class.

python
from django.db import models

from bloomerp.field_types.registry import FIELD_TYPE_REGISTRY, FieldTypeDefinition
from bloomerp.lookups.builtins import EQUALS


class WarehouseCodeField(models.CharField):
    '''Store a warehouse code as short text.'''


warehouse_code = FieldTypeDefinition(
    id="ExampleWarehouseCode",
    label="Warehouse code",
    description="A short warehouse reference.",
    model_field_cls=WarehouseCodeField,
    lookups=(EQUALS,),
)
FIELD_TYPE_REGISTRY.register("EXAMPLE_WAREHOUSE_CODE", warehouse_code)

Expose constructor defaults in the model builder

The model builder can apply the field constructor arguments when it creates the field.

python
from django.db import models

from bloomerp.field_types.registry import FIELD_TYPE_REGISTRY, FieldConstruction, FieldTypeDefinition


class AssetLabelField(models.CharField):
    '''Store an asset label as short text.'''


asset_label = FieldTypeDefinition(
    id="ExampleAssetLabel",
    label="Asset label",
    model_field_cls=AssetLabelField,
    construction=FieldConstruction(defaults={"max_length": 40}),
)
FIELD_TYPE_REGISTRY.register("EXAMPLE_ASSET_LABEL", asset_label)

Char Field

ID CharField · Lookup ID CHAR_FIELD

Store short text such as a name, title, or reference number, with a configurable length limit.

FieldValue
iconfa-solid fa-font

Code Field

ID CodeField · Lookup ID CODE_FIELD

Store source code and edit it with syntax highlighting for the configured language.

FieldValue
iconfa-solid fa-code

Choice Field

ID ChoiceField · Lookup ID CHOICE_FIELD

Store one value from a predefined set of text choices and display its human-readable label.

FieldValue
iconfa-solid fa-list

Text Field

ID TextField · Lookup ID TEXT_FIELD

Store longer, multiline text such as a description or note.

FieldValue
iconfa-solid fa-align-left

Email Field

ID EmailField · Lookup ID EMAIL_FIELD

Store an email address and validate its format.

FieldValue
iconfa-solid fa-envelope

URL Field

ID URLField · Lookup ID URL_FIELD

Store a web address and validate its URL format.

FieldValue
iconfa-solid fa-link

Address Field

ID AddressField · Lookup ID ADDRESS_FIELD

Store a structured postal address as JSON and edit its parts in an address widget.

FieldValue
iconfa-solid fa-location-dot

Phone Number Field

ID PhoneNumberField · Lookup ID PHONE_NUMBER_FIELD

Store a telephone number and edit it with Bloomerp's phone number widget.

FieldValue
iconfa-solid fa-phone

Slug Field

ID SlugField · Lookup ID SLUG_FIELD

Store a URL-friendly identifier for a record.

FieldValue
iconfa-solid fa-tag

IP Address Field

ID IPAddressField · Lookup ID IP_ADDRESS_FIELD

Store an IP address using Django's generic IP address field.

FieldValue
iconfa-solid fa-network-wired

Generic IP Address Field

ID GenericIPAddressField · Lookup ID GENERIC_IP_ADDRESS_FIELD

Store an IPv4 or IPv6 address, with an optional protocol restriction.

FieldValue
iconfa-solid fa-network-wired

Icon Field

ID IconField · Lookup ID ICON_FIELD

Store an icon identifier selected through Bloomerp's icon picker.

FieldValue
iconfa-solid fa-star

Country Field

ID CountryField · Lookup ID COUNTRY_FIELD

Choose a country and store its country code.

FieldValue
iconfa-solid fa-globe

Auto Field

ID AutoField · Lookup ID AUTO_FIELD

Use an automatically assigned integer as the record's primary key.

FieldValue
iconfa-solid fa-hashtag

Big Auto Field

ID BigAutoField · Lookup ID BIG_AUTO_FIELD

Use an automatically assigned large integer as the record's primary key.

FieldValue
iconfa-solid fa-hashtag

Small Auto Field

ID SmallAutoField · Lookup ID SMALL_AUTO_FIELD

Use an automatically assigned small integer as the record's primary key.

FieldValue
iconfa-solid fa-hashtag

Integer Field

ID IntegerField · Lookup ID INTEGER_FIELD

Store whole numbers such as quantities, counts, or offsets.

FieldValue
iconfa-solid fa-hashtag

Float Field

ID FloatField · Lookup ID FLOAT_FIELD

Store approximate numeric values with a floating-point representation.

FieldValue
iconfa-solid fa-calculator

Decimal Field

ID DecimalField · Lookup ID DECIMAL_FIELD

Store decimal values with a defined precision, such as prices or measurements.

FieldValue
iconfa-solid fa-calculator

Positive Integer Field

ID PositiveIntegerField · Lookup ID POSITIVE_INTEGER_FIELD

Store a whole number that is zero or greater.

FieldValue
iconfa-solid fa-plus

Positive Small Integer Field

ID PositiveSmallIntegerField · Lookup ID POSITIVE_SMALL_INTEGER_FIELD

Store a nonnegative whole number in the small-integer range.

FieldValue
iconfa-solid fa-plus

Big Integer Field

ID BigIntegerField · Lookup ID BIG_INTEGER_FIELD

Store large signed whole numbers.

FieldValue
iconfa-solid fa-hashtag

Small Integer Field

ID SmallIntegerField · Lookup ID SMALL_INTEGER_FIELD

Store signed whole numbers in the small-integer range.

FieldValue
iconfa-solid fa-hashtag

Boolean Field

ID BooleanField · Lookup ID BOOLEAN_FIELD

Store a true or false value, such as whether a feature is enabled.

FieldValue
iconfa-solid fa-toggle-on

Null Boolean Field

ID NullBooleanField · Lookup ID NULL_BOOLEAN_FIELD

Store true, false, or an unset value when the answer is unknown.

FieldValue
iconfa-solid fa-toggle-on

Date Field

ID DateField · Lookup ID DATE_FIELD

Store a calendar date for values such as deadlines or birthdays.

FieldValue
iconfa-solid fa-calendar-days

Week Field

ID WeekField · Lookup ID WEEK_FIELD

Store an ISO year and week for planning or reporting by week.

FieldValue
iconfa-solid fa-calendar-week

DateTime Field

ID DateTimeField · Lookup ID DATE_TIME_FIELD

Store a date and time for values such as appointments and timestamps.

FieldValue
iconfa-solid fa-clock

Time Field

ID TimeField · Lookup ID TIME_FIELD

Store a time of day independently of the date.

FieldValue
iconfa-solid fa-clock

Duration Field

ID DurationField · Lookup ID DURATION_FIELD

Store an elapsed time or interval.

FieldValue
iconfa-solid fa-hourglass-half

Foreign Key

ID ForeignKey · Lookup ID FOREIGN_KEY

Link a record to another model, such as an invoice to its customer.

FieldValue
iconfa-solid fa-link

One To One Field

ID OneToOneField · Lookup ID ONE_TO_ONE_FIELD

Link a record to one unique record in another model.

FieldValue
iconfa-solid fa-link

Many To Many Field

ID ManyToManyField · Lookup ID MANY_TO_MANY_FIELD

Link any number of records on either side, such as products with categories.

FieldValue
iconfa-solid fa-share-nodes

One To Many Field

ID OneToManyField · Lookup ID ONE_TO_MANY_FIELD

Access the collection of records that point back to this record through a foreign key.

FieldValue
iconfa-solid fa-share-nodes

User Field

ID UserField · Lookup ID USER_FIELD

Link a record to a user, such as its owner or assignee.

FieldValue
iconfa-solid fa-user

One To One User Field

ID OneToOneUserField · Lookup ID ONE_TO_ONE_USER_FIELD

Link a record uniquely to a user, such as a profile that each user can have once.

FieldValue
iconfa-solid fa-user

Generic Relation

ID GenericRelation · Lookup ID GENERIC_RELATION

Expose records that point to this object through a generic foreign key.

FieldValue
iconfa-solid fa-share-nodes

Generic Foreign Key

ID GenericForeignKey · Lookup ID GENERIC_FOREIGN_KEY

Expose a reference to a record whose model can vary.

FieldValue
iconfa-solid fa-link

Files

ID FilesRelationField · Lookup ID FILES_RELATION_FIELD

Show files attached to the current record through Bloomerp's file references.

FieldValue
iconfa-solid fa-paperclip

Property

ID Property · Lookup ID PROPERTY

Expose a computed model attribute as a field in Bloomerp.

FieldValue
iconfa-solid fa-sliders

File Field

ID FileField · Lookup ID FILE_FIELD

Store a reference to an uploaded file in Django storage.

FieldValue
iconfa-solid fa-file

Image Field

ID ImageField · Lookup ID IMAGE_FIELD

Store an uploaded image and validate it as an image.

FieldValue
iconfa-solid fa-image

UUID Field

ID UUIDField · Lookup ID UUID_FIELD

Store a universally unique identifier.

FieldValue
iconfa-solid fa-fingerprint

Binary Field

ID BinaryField · Lookup ID BINARY_FIELD

Store raw bytes in a database field.

FieldValue
iconfa-solid fa-code

JSON Field

ID JSONField · Lookup ID JSON_FIELD

Store JSON values, including objects, arrays, and nested data.

FieldValue
iconfa-solid fa-code

Array Field

ID ArrayField · Lookup ID ARRAY_FIELD

Expose the values in a PostgreSQL array as a field in Bloomerp.

FieldValue
iconfa-solid fa-list-ol

HStore Field

ID HStoreField · Lookup ID HSTORE_FIELD

Expose a PostgreSQL mapping of text keys to values as a field in Bloomerp.

FieldValue
iconfa-solid fa-box-archive

Status Field

ID StatusField · Lookup ID STATUS_FIELD

Store a status choice with an associated color for display.

FieldValue
iconfa-solid fa-signal

Bloomerp File Field

ID BloomerpFileField · Lookup ID BLOOMERP_FILE_FIELD

Attach one or more files to a record through Bloomerp's file library.

FieldValue
iconfa-solid fa-file-lines

Labels

ID BloomerpLabelsField · Lookup ID LABELS_FIELD

Assign multiple labels to a record and filter records by label membership.

FieldValue
iconfa-solid fa-tags