Data Fields

We extends the field classes from peewee with two properties (dt_orderable and dt_searchable) and two conversion methods (dt_order() and dt_search()) for the integration with DataTables server-side processing.

class flask_datatables.fields.Field(orderable=None, searchable=None, null=False, index=False, unique=False, column_name=None, default=None, primary_key=False, constraints=None, sequence=None, collation=None, unindexed=False, choices=None, help_text=None, verbose_name=None, index_type=None, db_column=None, _hidden=False)[source]

Bases: peewee.Field

Extending peewee.Field.

Parameters
  • orderable (Optional[Union[bool, Field]]) – Optional[Union[bool, peewee.Field]]: DataTables orderable field.

  • searchable (Optional[Union[bool, Field]]) – Optional[Union[bool, peewee.Field]]: DataTables searchable field.

  • **kwargs – Arbitrary arguments accepted by peewee.Field.

If orderable and/or searchable is a bool value, it indicates if the field supports DataTables ordering and/or searching:

  • True means the field is orderable and/or searchable, and it will refer to its properties dt_orderable and/or dt_searchable as its default field instance;

    Note

    If the property returns None, then the field is orderable and/or searchable by itself with its own values.

  • False disables ordering and searching on the field;

  • an instance of peewee.Field indicates that the current field is orderable and/or searchable through the given field instance.

Important

If orderable and/or searchable is an instance of peewee.Field, then its attributes orderable and/or searchable will be the corresponding instance.

If orderable and/or searchable is True, then it refers to its properties dt_orderable and/or dt_searchable as the actual value:

  • if the properties return an instance of peewee.Field, then the attributes will be the returned instance; i.e. the field is orderable and/or searchable by converting to the target field instead of itself;

  • if the properties return None, then the attributes will be True; i.e. the field is orderable and/or searchable by itself with its value.

If orderable and/or searchable is False, then the attributes will be False as well.

static dt_order(value)[source]

Convert value for DataTables ordering operation.

Parameters

value (Any) – Source value.

Return type

Any

Returns

Converted value.

Convert value for DataTables searching operation.

Parameters

value (Any) – Source value.

Return type

Any

Returns

Converted value.

property dt_orderable

DataTables default orderable field.

Return type

Optional[Field]

property dt_searchable

DataTables default searchable field.

Return type

Optional[Field]

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.AutoField(*args, **kwargs)[source]

Bases: peewee.AutoField, flask_datatables.fields.IntegerField

Extending peewee.AutoField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.BareField(adapt=None, *args, **kwargs)[source]

Bases: peewee.BareField, flask_datatables.fields.Field

Extending peewee.BareField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.BigAutoField(*args, **kwargs)[source]

Bases: peewee.BigAutoField, flask_datatables.fields.AutoField

Extending peewee.BigAutoField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.BigBitField(*args, **kwargs)[source]

Bases: peewee.BigBitField, flask_datatables.fields.BlobField

Extending peewee.BigBitField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.BigIntegerField(orderable=None, searchable=None, null=False, index=False, unique=False, column_name=None, default=None, primary_key=False, constraints=None, sequence=None, collation=None, unindexed=False, choices=None, help_text=None, verbose_name=None, index_type=None, db_column=None, _hidden=False)[source]

Bases: peewee.BigIntegerField, flask_datatables.fields.IntegerField

Extending peewee.BigIntegerField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.BinaryUUIDField(orderable=None, searchable=None, null=False, index=False, unique=False, column_name=None, default=None, primary_key=False, constraints=None, sequence=None, collation=None, unindexed=False, choices=None, help_text=None, verbose_name=None, index_type=None, db_column=None, _hidden=False)[source]

Bases: peewee.BinaryUUIDField, flask_datatables.fields.Field

Extending peewee.BinaryUUIDField.

Convert value for DataTables searching operation.

Parameters

value (UUID) – Source value.

Return type

str

Returns

Converted value.

property dt_searchable

DataTables default searchable field.

Return type

Optional[Field]

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.BitField(*args, **kwargs)[source]

Bases: peewee.BitField, flask_datatables.fields.BigIntegerField

Extending peewee.BitField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.BlobField(orderable=None, searchable=None, null=False, index=False, unique=False, column_name=None, default=None, primary_key=False, constraints=None, sequence=None, collation=None, unindexed=False, choices=None, help_text=None, verbose_name=None, index_type=None, db_column=None, _hidden=False)[source]

Bases: peewee.BlobField, flask_datatables.fields.Field

Extending peewee.BlobField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.BooleanField(orderable=None, searchable=None, null=False, index=False, unique=False, column_name=None, default=None, primary_key=False, constraints=None, sequence=None, collation=None, unindexed=False, choices=None, help_text=None, verbose_name=None, index_type=None, db_column=None, _hidden=False)[source]

Bases: peewee.BooleanField, flask_datatables.fields.Field

Extending peewee.BooleanField.

Convert value for DataTables searching operation.

Parameters

value (bool) – Source value.

Return type

str

Returns

Converted value.

property dt_searchable

DataTables default searchable field.

Return type

Optional[Field]

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.CharField(max_length=255, *args, **kwargs)[source]

Bases: peewee.CharField, flask_datatables.fields._StringField

Extending peewee.CharField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.DateField(formats=None, *args, **kwargs)[source]

Bases: peewee.DateField, flask_datatables.fields._BaseFormattedField

Extending peewee.DateField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.DateTimeField(formats=None, *args, **kwargs)[source]

Bases: peewee.DateTimeField, flask_datatables.fields._BaseFormattedField

Extending peewee.DateTimeField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.DecimalField(max_digits=10, decimal_places=5, auto_round=False, rounding=None, *args, **kwargs)[source]

Bases: peewee.DecimalField, flask_datatables.fields.Field

Extending peewee.DecimalField.

Convert value for DataTables searching operation.

Parameters

value (Decimal) – Source value.

Return type

str

Returns

Converted value.

property dt_searchable

DataTables default searchable field.

Return type

Optional[Field]

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.DoubleField(orderable=None, searchable=None, null=False, index=False, unique=False, column_name=None, default=None, primary_key=False, constraints=None, sequence=None, collation=None, unindexed=False, choices=None, help_text=None, verbose_name=None, index_type=None, db_column=None, _hidden=False)[source]

Bases: peewee.DoubleField, flask_datatables.fields.FloatField

Extending peewee.DoubleField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.FixedCharField(max_length=255, *args, **kwargs)[source]

Bases: peewee.FixedCharField, flask_datatables.fields.CharField

Extending peewee.FixedCharField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.FloatField(orderable=None, searchable=None, null=False, index=False, unique=False, column_name=None, default=None, primary_key=False, constraints=None, sequence=None, collation=None, unindexed=False, choices=None, help_text=None, verbose_name=None, index_type=None, db_column=None, _hidden=False)[source]

Bases: peewee.FloatField, flask_datatables.fields.Field

Extending peewee.FloatField.

Convert value for DataTables searching operation.

Parameters

value (float) – Source value.

Return type

str

Returns

Converted value.

property dt_searchable

DataTables default searchable field.

Return type

Optional[Field]

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.ForeignKeyField(model, field=None, backref=None, on_delete=None, on_update=None, deferrable=None, _deferred=None, rel_model=None, to_field=None, object_id_name=None, lazy_load=True, constraint_name=None, related_name=None, *args, **kwargs)[source]

Bases: peewee.ForeignKeyField, flask_datatables.fields.Field

Extending peewee.ForeignKeyField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.IdentityField(generate_always=False, **kwargs)[source]

Bases: peewee.IdentityField, flask_datatables.fields.AutoField

Extending peewee.IdentityField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.IntegerField(orderable=None, searchable=None, null=False, index=False, unique=False, column_name=None, default=None, primary_key=False, constraints=None, sequence=None, collation=None, unindexed=False, choices=None, help_text=None, verbose_name=None, index_type=None, db_column=None, _hidden=False)[source]

Bases: peewee.IntegerField, flask_datatables.fields.Field

Extending peewee.IntegerField.

Convert value for DataTables searching operation.

Parameters

value (int) – Source value.

Return type

str

Returns

Converted value.

property dt_searchable

DataTables default searchable field.

Return type

Optional[Field]

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.IPField(orderable=None, searchable=None, null=False, index=False, unique=False, column_name=None, default=None, primary_key=False, constraints=None, sequence=None, collation=None, unindexed=False, choices=None, help_text=None, verbose_name=None, index_type=None, db_column=None, _hidden=False)[source]

Bases: peewee.IPField, flask_datatables.fields.BigIntegerField

Extending peewee.IPField.

Convert value for DataTables searching operation.

Parameters

value (str) – Source value.

Return type

str

Returns

Converted value.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.ManyToManyField(model, backref=None, through_model=None, on_delete=None, on_update=None, _is_backref=False)[source]

Bases: peewee.ManyToManyField, flask_datatables.fields.Field

Extending peewee.ManyToManyField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.PrimaryKeyField(*args, **kwargs)[source]

Bases: peewee.PrimaryKeyField, flask_datatables.fields.AutoField

Extending peewee.PrimaryKeyField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.SmallIntegerField(orderable=None, searchable=None, null=False, index=False, unique=False, column_name=None, default=None, primary_key=False, constraints=None, sequence=None, collation=None, unindexed=False, choices=None, help_text=None, verbose_name=None, index_type=None, db_column=None, _hidden=False)[source]

Bases: peewee.SmallIntegerField, flask_datatables.fields.IntegerField

Extending peewee.SmallIntegerField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.TextField(orderable=None, searchable=None, null=False, index=False, unique=False, column_name=None, default=None, primary_key=False, constraints=None, sequence=None, collation=None, unindexed=False, choices=None, help_text=None, verbose_name=None, index_type=None, db_column=None, _hidden=False)[source]

Bases: peewee.TextField, flask_datatables.fields._StringField

Extending peewee.TextField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.TimeField(formats=None, *args, **kwargs)[source]

Bases: peewee.TimeField, flask_datatables.fields._BaseFormattedField

Extending peewee.TimeField.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.TimestampField(*args, **kwargs)[source]

Bases: peewee.TimestampField, flask_datatables.fields.BigIntegerField

Extending peewee.TimestampField.

Convert value for DataTables searching operation.

Parameters

value (datetime) – Source value.

Return type

str

Returns

Converted value.

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.

class flask_datatables.fields.UUIDField(orderable=None, searchable=None, null=False, index=False, unique=False, column_name=None, default=None, primary_key=False, constraints=None, sequence=None, collation=None, unindexed=False, choices=None, help_text=None, verbose_name=None, index_type=None, db_column=None, _hidden=False)[source]

Bases: peewee.UUIDField, flask_datatables.fields.Field

Extending peewee.UUIDField.

Convert value for DataTables searching operation.

Parameters

value (UUID) – Source value.

Return type

str

Returns

Converted value.

property dt_searchable

DataTables default searchable field.

Return type

Optional[Field]

orderable: Union[bool, Field]

DataTables integration orderable flag.

searchable: Union[bool, Field]

DataTables integration searchable flag.