EditColumn¶
Base class: Column
The column class for EditTable.
Parameters with the prefix filter__ will be passed along downstream to the Filter instance if applicable. This can be used to tweak the filtering of a column.
Refinable members¶
after (evaluated)¶
Set the order of columns, see the howto on ordering for an example.
Type: Union[int, str]
See after
- Cookbook:
assets¶
Type: Namespace
See assets
attr (evaluated)¶
What attribute to use, defaults to same as name. Follows django conventions to access properties of properties, so foo__bar is equivalent to the python code foo.bar. This parameter is based on the name of the Column if you use the declarative style of creating tables.
Type: str
See attr
auto_rowspan (evaluated)¶
enable automatic rowspan for this column. To join two cells with rowspan, just set this auto_rowspan to True and make those two cells output the same text and we’ll handle the rest.
Type: bool
Default: False
- Cookbook:
bulk¶
Namespace to configure bulk actions. See howto on bulk editing for an example and more information.
Type: Namespace
- Cookbook:
cell¶
Customize the cell, see howto on rendering and howto on links
Type: Namespace
choices (evaluated)¶
Type: Iterable
data_retrieval_method (evaluated)¶
Default: DataRetrievalMethods.attribute_access
display_name¶
the text of the header for this column. By default this is based on the _name so normally you won’t need to specify it.
See name
endpoints¶
Type: Namespace
See endpoints
extra¶
Type: Dict[str, Any]
See extra
extra_evaluated¶
Type: Dict[str, Any]
See extra
extra_params¶
See extra_params
field¶
Type: Field
filter¶
Type: Namespace
group (evaluated)¶
string describing the group of the header. If this parameter is used the header of the table now has two rows. Consecutive identical groups on the first level of the header are joined in a nice way.
Type: Optional[str]
- Cookbook:
header (evaluated)¶
Type: Namespace
include (evaluated)¶
set this to False to hide the column
Type: bool
See include
iommi_style¶
Type: str
See iommi_style
model (evaluated)¶
Type: Type[Model]
model_field¶
model_field_name¶
render_column (evaluated)¶
If set to False the column won’t be rendered in the table, but still be available in table.columns. This can be useful if you want some other feature from a column like filtering.
Type: bool
Default: True
row_group (evaluated)¶
Type: Namespace
- Cookbook:
sort_default_desc (evaluated)¶
Set to True to make table sort link to sort descending first.
Type: bool
Default: False
sort_key¶
string denoting what value to use as sort key when this column is selected for sorting. (Or callable when rendering a table from list.)
sortable (evaluated)¶
set this to False to disable sorting on this column
Type: bool
Default: iommi.table.default_sortable
superheader (evaluated)¶
Shortcuts¶
EditColumn.boolean¶
Shortcut to render booleans as a check mark if true or blank if false.
table = Table(
columns__name=Column(),
columns__boolean=Column.boolean(),
rows=[
Struct(name='true!', boolean=True),
Struct(name='false!', boolean=False),
]
)
Defaults¶
filter__call_target__attributeboolean
filter__field__call_target__attributeboolean_tristate
bulk__call_target__attributeboolean
cell__formatlambda value, **_: mark_safe(f'<span title="{gettext_lazy("Yes")}">✔</span>') if value else ''
EditColumn.boolean_tristate¶
This shortcut sets up boolean_tristate for the filter.
Parent: EditColumn.boolean
Defaults¶
filter__call_target__attributeboolean_tristate
EditColumn.choice¶
This shortcut sets up choices for the filter and bulk form.
Defaults¶
bulk__call_target__attributechoice
bulk__choicesiommi.table.get_choices_from_column
filter__call_target__attributechoice
filter__choicesiommi.table.get_choices_from_column
EditColumn.choice_queryset¶
This shortcut sets up choices for the filter and bulk form for the choice queryset case.
Parent: EditColumn.choice
Defaults¶
bulk__call_target__attributechoice_queryset
filter__call_target__attributechoice_queryset
EditColumn.date¶
Defaults¶
filter__call_target__attributedate
filter__query_operator_to_q_operatorlambda op: {'=': 'exact', ':': 'contains'}.get(op)
bulk__call_target__attributedate
EditColumn.datetime¶
Defaults¶
filter__call_target__attributedatetime
filter__query_operator_to_q_operatorlambda op: {'=': 'exact', ':': 'contains'}.get(op)
bulk__call_target__attributedatetime
EditColumn.decimal¶
Defaults¶
bulk__call_target__attributedecimal
filter__call_target__attributedecimal
EditColumn.delete¶
Defaults¶
header__templateiommi/table/header.html
sortableFalse
filter__is_valid_filterlambda **_: (True, '')
filter__field__includeFalse
attrNone
display_nameDelete
cell__attrs__class__deleteTrue
cell__attrs__data-iommi-edit-table-delete-row-cellTrue
EditColumn.download¶
Shortcut for creating a clickable download icon. The URL defaults to your_object.get_absolute_url() + 'download/'. Specify the option cell__url to override.
table = Table(
auto__model=Album,
columns__download=Column.download(),
)
Parent: EditColumn.icon
Defaults¶
cell__urllambda row, **_: row.get_absolute_url() + 'download/'
cell__valuelambda row, **_: getattr(row, 'pk', False)
display_nameDownload
EditColumn.duration¶
Parent: EditColumn.text
Defaults¶
bulk__call_target__attributeduration
filter__call_target__attributeduration
EditColumn.edit¶
Shortcut for creating a clickable edit icon. The URL defaults to your_object.get_absolute_url() + 'edit/'. Specify the option cell__url to override.
table = Table(
auto__model=Album,
columns__edit=Column.edit(after=0),
)
Parent: EditColumn.icon
Defaults¶
cell__urllambda row, **_: row.get_absolute_url() + 'edit/'
display_nameEdit
EditColumn.email¶
Defaults¶
filter__call_target__attributeemail
bulk__call_target__attributeemail
EditColumn.file¶
Defaults¶
bulk__call_target__attributefile
filter__call_target__attributefile
cell__formatlambda value, **_: str(value)
EditColumn.float¶
Parent: EditColumn.number
Defaults¶
filter__call_target__attributefloat
bulk__call_target__attributefloat
EditColumn.foreign_key¶
EditColumn.foreign_key_reverse¶
Defaults¶
bulk__call_target__attributeforeign_key_reverse
filter__call_target__attributeforeign_key_reverse
cell__formatlambda value, **_: ', '.join(['%s' % x for x in value.all()])
data_retrieval_methodDataRetrievalMethods.prefetch
sortableFalse
extra__django_related_fieldTrue
display_namelambda column, **_: capitalize(column.model_field.remote_field.model._meta.verbose_name_plural)
EditColumn.icon¶
Shortcut to create font awesome-style icons.
Parameters¶
extra__iconthe name of the icon
Defaults¶
display_name""
cell__valuelambda table, **_: True
cell__formatiommi.table.default_icon__cell__format
attrNone
EditColumn.integer¶
Parent: EditColumn.number
Defaults¶
filter__call_target__attributeinteger
bulk__call_target__attributeinteger
EditColumn.link¶
Shortcut for creating a cell that is a link. The URL is the result of calling get_absolute_url() on the object.
EditColumn.many_to_many¶
Parent: EditColumn.related_multiple
EditColumn.many_to_many_reverse¶
Defaults¶
bulk__call_target__attributemany_to_many_reverse
filter__call_target__attributemany_to_many_reverse
EditColumn.multi_choice¶
This shortcut sets up choices for the filter and bulk form for the multi choice case.
Parent: EditColumn.choice
Defaults¶
bulk__call_target__attributemulti_choice
filter__call_target__attributemulti_choice
EditColumn.multi_choice_queryset¶
This shortcut sets up choices for the filter and bulk form for the multi choice queryset case.
Parent: EditColumn.choice_queryset
Defaults¶
bulk__call_target__attributemulti_choice_queryset
filter__call_target__attributemulti_choice_queryset
EditColumn.number¶
EditColumn.reorder_handle¶
Defaults¶
sortableFalse
field__call_target__attributehidden
field__parseiommi.form.int_parse
field__includeTrue
field__input__attrs__data-reordering-valueTrue
cell__attrs__titleDrag and drop to reorder
cell__attrs__class__reordering-handle-cellTrue
cell__attrs__data-iommi-reordering-handleTrue
after<object object at 0x7eb20e78a2c0>
EditColumn.run¶
Shortcut for creating a clickable run icon. The URL defaults to your_object.get_absolute_url() + 'run/'. Specify the option cell__url to override.
table = Table(
auto__model=Album,
columns__run=Column.run(),
)
Parent: EditColumn.icon
Defaults¶
cell__urllambda row, **_: row.get_absolute_url() + 'run/'
display_nameRun
EditColumn.select¶
Shortcut for a column of checkboxes to select rows. This is useful for implementing bulk operations.
By default tables have a column named select that is hidden that is used for this purpose, so you only
need to turn it on to get it. See the example below.
To implement a custom post handler that operates on the selected rows, do
def my_handler(table):
rows = table.selection()
# rows will either be a queryset, or a list of elements
# matching the type of rows of the table
...
table = Table(
auto__model=Album,
columns__select__include=True,
bulk__actions__submit=Action.submit(post_handler=my_handler)
)
Parameters¶
extra__checkbox_namethe name of the checkbox. Default is `"pk", resulting in checkboxes like"pk_1234".`
extra__checkedcallable to specify if the checkbox should be checked initially. Defaults to `False.`
Defaults¶
header__templateiommi/table/select_column_header.html
sortableFalse
filter__is_valid_filterlambda **_: (True, '')
filter__field__includeFalse
attrNone
cell__valuelambda table, cells, row, **_: ( row.pk if isinstance(table.rows, QuerySet) # row_index is the visible row number # See selection() for the code that does the lookup else cells.row_index )
cell__formatlambda column, row, value, **kwargs: format_html( # language=HTML '<input type="checkbox" class="checkbox" name="{checkbox_name}_{row_id}" {checked_str} />', checkbox_name=column.extra.checkbox_name, row_id=value, checked_str=( 'checked' if evaluate_strict(column.extra.checked, column=column, row=row, value=value, **kwargs) else '' ), )
extra__checkbox_namepk
extra__checkedlambda **_: False
extra__iconfa fa-check-square-o
EditColumn.substring¶
Defaults¶
filter__query_operator_for_field:
EditColumn.text¶
This is an explicit synonym for Column().
Defaults¶
bulk__call_target__attributetext
filter__call_target__attributetext
EditColumn.textarea¶
Parent: EditColumn.text
EditColumn.time¶
Defaults¶
filter__call_target__attributetime
filter__query_operator_to_q_operatorlambda op: {'=': 'exact', ':': 'contains'}.get(op)
bulk__call_target__attributetime