fairdm.core.descriptions#

The vocabulary-driven descriptions form shared across the core record types.

A related model carries at most one description of each vocabulary type, so this is a single form with one field per concept rather than a row set. Driving the field set off the collection lets the descriptions page grow when the vocabulary does, with no code change.

Module Contents#

Classes#

VocabularyDescriptionsForm

One text area per concept in the collection a related model’s type offers.

API#

class VocabularyDescriptionsForm(*args, related_model, instance, **kwargs)#

Bases: django.forms.Form

One text area per concept in the collection a related model’s type offers.

Each field is named after the concept’s address, labelled with its name and helped by its definition.

Args: *args: Positional arguments passed to forms.Form. related_model: The description model whose type collection defines the fields and which stores the rows. instance: The record the descriptions belong to. **kwargs: Keyword arguments passed to forms.Form.

Initialization

definition(concept)#

Return a concept’s definition in the reading language, else in any language.

Args: concept: A controlled_vocabularies.Record.

Returns: The definition, or an empty string when the concept has none.

save()#

Write, update or delete one row per area, deleting the row when the area is blank.