lino.utils.mldbc.fields

Defines the babel field classes (BabelCharField and BabelTextField) and the LanguageField class.

Babel fields are fields which "generate" in the Django model a series of normal CharFields (or TextFields), one for each lino.core.site.Site.language.

Example:

class Foo(models.Model):
    name = BabelCharField(_("Foo"), max_length=200)

(This module's source code is available here.)

Functions

contribute_to_class(field, cls, fieldclass, **kw)

Used by both BabelCharField and BabelTextField

Classes

BabelCharField(*args, **kwargs)

Define a variable number of CharField database fields, one for each language of your lino.core.site.Site.languages.

BabelTextField(*args, **kw)

Define a variable number of clones of the "master" field, one for each language .

LanguageField(*args, **kw)

A field that lets the user select a language from the available lino.core.site.Site.languages.

lino.utils.mldbc.fields.contribute_to_class(field, cls, fieldclass, **kw)

Used by both BabelCharField and BabelTextField

class lino.utils.mldbc.fields.BabelCharField(*args, **kwargs)

Bases: django.db.models.fields.CharField

Define a variable number of CharField database fields, one for each language of your lino.core.site.Site.languages. See Multilingual database content.

class lino.utils.mldbc.fields.BabelTextField(*args, **kw)

Bases: lino.core.fields.RichTextField

Define a variable number of clones of the "master" field, one for each language . See Multilingual database content.

class lino.utils.mldbc.fields.LanguageField(*args, **kw)

Bases: django.db.models.fields.CharField

A field that lets the user select a language from the available lino.core.site.Site.languages.

See also lino.core.model.Model.get_print_language().