Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More

lino.utils.choosers

Extends the possibilities for defining choices for fields of a Django model.

Example values in Lino utilities.

Functions

action_chooser(**options)

check_for_chooser(holder, field)

chooser(**options)

Decorator which turns the method into a chooser.

get_choosers_dict(holder)

make_converter(f[, lookup_fields])

noop(x)

uses_simple_values(holder, fld)

used by lino.core.store

Classes

BaseChooser()

ChoiceConverter(field)

Converter for ChoiceListField.

ChoicesChooser(field)

Chooser(model, field, meth)

Holds information about the possible choices of a field.

Converter(field)

DateConverter(field)

DecimalConverter(field)

FieldChooser(field)

ForeignKeyConverter(field, lookup_field)

Converter for ForeignKey fields.

GenericForeignKeyConverter(field)

Converter for GenericForeignKey fields.

LookupConverter(field, lookup_field)

A Converter for ForeignKey and ManyToManyField.

ManyToManyConverter(field, lookup_field)

Converter for ManyToMany fields.

class lino.utils.choosers.LookupConverter(field, lookup_field)

Bases: Converter

A Converter for ForeignKey and ManyToManyField. If the lookup_field is a BabelField, then it tries all available languages.

class lino.utils.choosers.ChoiceConverter(field)

Bases: Converter

Converter for ChoiceListField.

If you specify a string, then it can be a value or a name.

class lino.utils.choosers.ForeignKeyConverter(field, lookup_field)

Bases: LookupConverter

Converter for ForeignKey fields.

class lino.utils.choosers.GenericForeignKeyConverter(field)

Bases: Converter

Converter for GenericForeignKey fields.

class lino.utils.choosers.ManyToManyConverter(field, lookup_field)

Bases: LookupConverter

Converter for ManyToMany fields.

class lino.utils.choosers.Chooser(model, field, meth)

Bases: FieldChooser

Holds information about the possible choices of a field.

get_data_elem(name)

Calls dd.Actor.get_data_elem() or dd.Model.get_data_elem() or dd.Action.get_data_elem().

get_choices(**context)

Return a list of choices for this chooser, using keyword parameters as context.

get_request_choices(ar, tbl)

Return a list of choices for this chooser, using a HttpRequest to build the context.

lino.utils.choosers.uses_simple_values(holder, fld)

used by lino.core.store

lino.utils.choosers.chooser(**options)

Decorator which turns the method into a chooser.