fairdm.contrib.collections.tables#

Table classes and column helpers for sample and measurement listings.

Module Contents#

Classes#

BaseTable

Base table for all listings, adding type-based column classes and header tooltips.

SampleTable

Listing table for samples.

MeasurementTable

Listing table for measurements.

Functions#

render_concept_many_to_many

Render a concept many-to-many value as comma-separated links.

Data#

API#

render_concept_many_to_many(value)[source]#

Render a concept many-to-many value as comma-separated links.

Args: value: The related manager for the concept field.

Returns: HTML with one link per concept, or an empty string when there are none.

field_map#

None

class BaseTable(*args, **kwargs)[source]#

Bases: django_tables2.Table

Base table for all listings, adding type-based column classes and header tooltips.

Args: *args: Passed to django_tables2.Table. **kwargs: Passed to django_tables2.Table.

Attributes: id: The hidden UUID column. dataset: The dataset icon column.

Initialization

id#

‘Column(…)’

dataset#

‘Column(…)’

render_dataset(value)[source]#

Link the dataset icon unless the dataset is private.

A published dataset can still be private, and its records stay in the listing without a link to a page the visitor cannot read.

value_dataset(value)[source]#

Export the dataset’s UUID.

configure_column_attrs()[source]#

Set each column’s type and name CSS classes and its header tooltip from the model field.

update_concept_field_render_methods()[source]#

Render concept many-to-many columns as links.

class SampleTable(*args, **kwargs)[source]#

Bases: fairdm.contrib.collections.tables.BaseTable

Listing table for samples.

Initialization

name#

‘Column(…)’

latitude#

‘Column(…)’

longitude#

‘Column(…)’

class Meta[source]#
attrs#

None

sequence#

(‘dataset’, ‘…’)

order_by#

(‘added’, ‘id’)

class MeasurementTable(*args, **kwargs)[source]#

Bases: fairdm.contrib.collections.tables.BaseTable

Listing table for measurements.

Initialization

name#

‘Column(…)’

sample#

‘Column(…)’

latitude#

‘Column(…)’

longitude#

‘Column(…)’

class Meta[source]#
attrs#

None

order_by#

(‘-modified’, ‘id’)

render_sample(value)[source]#

Link the sample only when its dataset is published.