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:
FieldExtending
peewee.Field.- Parameters:
 orderable (
Union[bool,Field,None]) – Optional[Union[bool, peewee.Field]]: DataTables orderable field.searchable (
Union[bool,Field,None]) – Optional[Union[bool, peewee.Field]]: DataTables searchable field.**kwargs – Arbitrary arguments accepted by
peewee.Field.null (bool) –
index (bool) –
unique (bool) –
column_name (Optional[str]) –
default (Any) –
primary_key (bool) –
constraints (Optional[List[SQL]]) –
sequence (Optional[str]) –
collation (Optional[str]) –
unindexed (bool) –
help_text (Optional[str]) –
verbose_name (Optional[str]) –
index_type (Optional[str]) –
db_column (Optional[str]) –
_hidden (bool) –
If
orderableand/orsearchableis aboolvalue, it indicates if the field supports DataTables ordering and/or searching:Truemeans the field is orderable and/or searchable, and it will refer to its propertiesdt_orderableand/ordt_searchableas its default field instance;Note
If the property returns
None, then the field is orderable and/or searchable by itself with its own values.Falsedisables ordering and searching on the field;an instance of
peewee.Fieldindicates that the current field is orderable and/or searchable through the given field instance.
Important
If
orderableand/orsearchableis an instance ofpeewee.Field, then its attributesorderableand/orsearchablewill be the corresponding instance.If
orderableand/orsearchableisTrue, then it refers to its propertiesdt_orderableand/ordt_searchableas 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 beTrue; i.e. the field is orderable and/or searchable by itself with its value.
If
orderableand/orsearchableisFalse, then the attributes will beFalseas well.- static dt_order(value)[source]¶
 Convert value for DataTables ordering operation.
- static dt_search(value)[source]¶
 Convert value for DataTables searching operation.
- property dt_orderable: Field | None¶
 DataTables default orderable field.
- property dt_searchable: Field | None¶
 DataTables default searchable 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:
AutoField,IntegerFieldExtending
peewee.AutoField.
- class flask_datatables.fields.BareField(adapt=None, *args, **kwargs)[source]¶
 Bases:
BareField,FieldExtending
peewee.BareField.
- class flask_datatables.fields.BigAutoField(*args, **kwargs)[source]¶
 Bases:
BigAutoField,AutoFieldExtending
peewee.BigAutoField.
- class flask_datatables.fields.BigBitField(*args, **kwargs)[source]¶
 Bases:
BigBitField,BlobFieldExtending
peewee.BigBitField.
- 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:
BigIntegerField,IntegerFieldExtending
peewee.BigIntegerField.- Parameters:
 null (bool) –
index (bool) –
unique (bool) –
column_name (Optional[str]) –
default (Any) –
primary_key (bool) –
constraints (Optional[List[SQL]]) –
sequence (Optional[str]) –
collation (Optional[str]) –
unindexed (bool) –
help_text (Optional[str]) –
verbose_name (Optional[str]) –
index_type (Optional[str]) –
db_column (Optional[str]) –
_hidden (bool) –
- 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:
BinaryUUIDField,FieldExtending
peewee.BinaryUUIDField.- Parameters:
 null (bool) –
index (bool) –
unique (bool) –
column_name (Optional[str]) –
default (Any) –
primary_key (bool) –
constraints (Optional[List[SQL]]) –
sequence (Optional[str]) –
collation (Optional[str]) –
unindexed (bool) –
help_text (Optional[str]) –
verbose_name (Optional[str]) –
index_type (Optional[str]) –
db_column (Optional[str]) –
_hidden (bool) –
- static dt_search(value)[source]¶
 Convert value for DataTables searching operation.
- property dt_searchable: Field | None¶
 DataTables default searchable field.
- class flask_datatables.fields.BitField(*args, **kwargs)[source]¶
 Bases:
BitField,BigIntegerFieldExtending
peewee.BitField.
- 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:
BlobField,FieldExtending
peewee.BlobField.- Parameters:
 null (bool) –
index (bool) –
unique (bool) –
column_name (Optional[str]) –
default (Any) –
primary_key (bool) –
constraints (Optional[List[SQL]]) –
sequence (Optional[str]) –
collation (Optional[str]) –
unindexed (bool) –
help_text (Optional[str]) –
verbose_name (Optional[str]) –
index_type (Optional[str]) –
db_column (Optional[str]) –
_hidden (bool) –
- 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:
BooleanField,FieldExtending
peewee.BooleanField.- Parameters:
 null (bool) –
index (bool) –
unique (bool) –
column_name (Optional[str]) –
default (Any) –
primary_key (bool) –
constraints (Optional[List[SQL]]) –
sequence (Optional[str]) –
collation (Optional[str]) –
unindexed (bool) –
help_text (Optional[str]) –
verbose_name (Optional[str]) –
index_type (Optional[str]) –
db_column (Optional[str]) –
_hidden (bool) –
- static dt_search(value)[source]¶
 Convert value for DataTables searching operation.
- property dt_searchable: Field | None¶
 DataTables default searchable field.
- class flask_datatables.fields.CharField(max_length=255, *args, **kwargs)[source]¶
 Bases:
CharField,_StringFieldExtending
peewee.CharField.
- class flask_datatables.fields.DateField(formats=None, *args, **kwargs)[source]¶
 Bases:
DateField,_BaseFormattedFieldExtending
peewee.DateField.
- class flask_datatables.fields.DateTimeField(formats=None, *args, **kwargs)[source]¶
 Bases:
DateTimeField,_BaseFormattedFieldExtending
peewee.DateTimeField.
- class flask_datatables.fields.DecimalField(max_digits=10, decimal_places=5, auto_round=False, rounding=None, *args, **kwargs)[source]¶
 Bases:
DecimalField,FieldExtending
peewee.DecimalField.- static dt_search(value)[source]¶
 Convert value for DataTables searching operation.
- property dt_searchable: Field | None¶
 DataTables default searchable field.
- 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:
DoubleField,FloatFieldExtending
peewee.DoubleField.- Parameters:
 null (bool) –
index (bool) –
unique (bool) –
column_name (Optional[str]) –
default (Any) –
primary_key (bool) –
constraints (Optional[List[SQL]]) –
sequence (Optional[str]) –
collation (Optional[str]) –
unindexed (bool) –
help_text (Optional[str]) –
verbose_name (Optional[str]) –
index_type (Optional[str]) –
db_column (Optional[str]) –
_hidden (bool) –
- class flask_datatables.fields.FixedCharField(max_length=255, *args, **kwargs)[source]¶
 Bases:
FixedCharField,CharFieldExtending
peewee.FixedCharField.
- 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:
FloatField,FieldExtending
peewee.FloatField.- Parameters:
 null (bool) –
index (bool) –
unique (bool) –
column_name (Optional[str]) –
default (Any) –
primary_key (bool) –
constraints (Optional[List[SQL]]) –
sequence (Optional[str]) –
collation (Optional[str]) –
unindexed (bool) –
help_text (Optional[str]) –
verbose_name (Optional[str]) –
index_type (Optional[str]) –
db_column (Optional[str]) –
_hidden (bool) –
- static dt_search(value)[source]¶
 Convert value for DataTables searching operation.
- property dt_searchable: Field | None¶
 DataTables default searchable field.
- 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:
ForeignKeyField,FieldExtending
peewee.ForeignKeyField.
- class flask_datatables.fields.IdentityField(generate_always=False, **kwargs)[source]¶
 Bases:
IdentityField,AutoFieldExtending
peewee.IdentityField.
- 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:
IntegerField,FieldExtending
peewee.IntegerField.- Parameters:
 null (bool) –
index (bool) –
unique (bool) –
column_name (Optional[str]) –
default (Any) –
primary_key (bool) –
constraints (Optional[List[SQL]]) –
sequence (Optional[str]) –
collation (Optional[str]) –
unindexed (bool) –
help_text (Optional[str]) –
verbose_name (Optional[str]) –
index_type (Optional[str]) –
db_column (Optional[str]) –
_hidden (bool) –
- static dt_search(value)[source]¶
 Convert value for DataTables searching operation.
- property dt_searchable: Field | None¶
 DataTables default searchable field.
- 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:
IPField,BigIntegerFieldExtending
peewee.IPField.- Parameters:
 null (bool) –
index (bool) –
unique (bool) –
column_name (Optional[str]) –
default (Any) –
primary_key (bool) –
constraints (Optional[List[SQL]]) –
sequence (Optional[str]) –
collation (Optional[str]) –
unindexed (bool) –
help_text (Optional[str]) –
verbose_name (Optional[str]) –
index_type (Optional[str]) –
db_column (Optional[str]) –
_hidden (bool) –
- static dt_search(value)[source]¶
 Convert value for DataTables searching operation.
- class flask_datatables.fields.ManyToManyField(model, backref=None, through_model=None, on_delete=None, on_update=None, prevent_unsaved=True, _is_backref=False)[source]¶
 Bases:
ManyToManyField,FieldExtending
peewee.ManyToManyField.
- class flask_datatables.fields.PrimaryKeyField(*args, **kwargs)[source]¶
 Bases:
PrimaryKeyField,AutoFieldExtending
peewee.PrimaryKeyField.
- 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:
SmallIntegerField,IntegerFieldExtending
peewee.SmallIntegerField.- Parameters:
 null (bool) –
index (bool) –
unique (bool) –
column_name (Optional[str]) –
default (Any) –
primary_key (bool) –
constraints (Optional[List[SQL]]) –
sequence (Optional[str]) –
collation (Optional[str]) –
unindexed (bool) –
help_text (Optional[str]) –
verbose_name (Optional[str]) –
index_type (Optional[str]) –
db_column (Optional[str]) –
_hidden (bool) –
- 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:
TextField,_StringFieldExtending
peewee.TextField.- Parameters:
 null (bool) –
index (bool) –
unique (bool) –
column_name (Optional[str]) –
default (Any) –
primary_key (bool) –
constraints (Optional[List[SQL]]) –
sequence (Optional[str]) –
collation (Optional[str]) –
unindexed (bool) –
help_text (Optional[str]) –
verbose_name (Optional[str]) –
index_type (Optional[str]) –
db_column (Optional[str]) –
_hidden (bool) –
- class flask_datatables.fields.TimeField(formats=None, *args, **kwargs)[source]¶
 Bases:
TimeField,_BaseFormattedFieldExtending
peewee.TimeField.
- class flask_datatables.fields.TimestampField(*args, **kwargs)[source]¶
 Bases:
TimestampField,BigIntegerFieldExtending
peewee.TimestampField.- static dt_search(value)[source]¶
 Convert value for DataTables searching operation.
- 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:
UUIDField,FieldExtending
peewee.UUIDField.- Parameters:
 null (bool) –
index (bool) –
unique (bool) –
column_name (Optional[str]) –
default (Any) –
primary_key (bool) –
constraints (Optional[List[SQL]]) –
sequence (Optional[str]) –
collation (Optional[str]) –
unindexed (bool) –
help_text (Optional[str]) –
verbose_name (Optional[str]) –
index_type (Optional[str]) –
db_column (Optional[str]) –
_hidden (bool) –
- static dt_search(value)[source]¶
 Convert value for DataTables searching operation.
- property dt_searchable: Field | None¶
 DataTables default searchable field.