To equip a
Language model with a family relation, the model should inherit from
clld_glottologfamily_plugin.models.HasFamilyMixin. This relation can be populated upon
database initialization calling
The families assigned in this way have an associated icon which can be used as map marker.
To make this easier, a custom
IMapMarker may inherit from
DataTable columns suitable for tables listing
Language objects can be
used as follows:
from clld.web.datatables.language import Languages from clld_glottologfamily_plugin.datatables import FamilyCol, MacroareaCol from clld_glottologfamily_plugin.models import Family from models import CustomLanguage class LanguagesWithFamily(Languages): def base_query(self, query): return query.outerjoin(Family) # note: isolates will have no related family! def col_defs(self): res = Languages.col_defs(self) res.append(MacroareaCol(self, 'macroarea', language_cls=CustomLanguage)) res.append(FamilyCol(self, 'family', language_cls=CustomLanguage)) return res
Family information is retrieved from Glottolog, based on the
idattribute of a language. This will only work if
idis either a glottocode or an ISO 639-3 code.
If no related family is found,
Nonewill be assigned - rather than a dummy isolates family or individual one-member families derived from the language.