Module Expr Str ImportFrom alias ImportFrom alias Import alias Assign NameStore Call AttributeLoad NameLoad attr NameLoad ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Pass decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad ImportFrom alias If UnaryOpNot Call NameLoad NameLoad body Assign AttributeStore NameLoad attr Call NameLoad NameLoad Str NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad Str NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad Str AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr ListLoad For NameStore AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpAdd NameLoad Str Assign AttributeStore NameLoad attr ListLoad For NameStore AttributeLoad NameLoad attr body Assign NameStore Call NameLoad NameLoad If CompareIsNot NameLoad NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If Call NameLoad NameLoad BinOpMod Str AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad BinOpMod Str AttributeLoad NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BinOpMod Str TupleLoad AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call NameLoad NameLoad BinOpMod Str AttributeLoad AttributeLoad NameLoad attr attr Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If CompareIs NameLoad NameLoad body Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg kwarg body For TupleStore NameStore NameStore Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index SubscriptLoad AttributeLoad NameLoad attr Index NameLoad NameLoad Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults kwarg body Expr Str Assign NameStore ListLoad For NameStore AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str ImportFrom alias Assign NameStore Dict If CompareIsNot AttributeLoad NameLoad attr NameLoad body Assign NameStore Call NameLoad NameLoad If CompareIsNot AttributeLoad NameLoad attr NameLoad body Assign NameStore AttributeLoad NameLoad attr orelse Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr TryExcept body Assign NameStore Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad attr handlers ExceptHandler type AttributeLoad NameLoad attr body Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad If BoolOpAnd NameLoad NameLoad body TryExcept body Assign SubscriptStore NameLoad Index AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad handlers ExceptHandler type NameLoad body Raise Call NameLoad Str NameLoad AttributeLoad NameLoad attr ExceptHandler type AttributeLoad NameLoad attr body Raise Call NameLoad BinOpMod Str TupleLoad AttributeLoad NameLoad attr NameLoad For TupleStore NameStore NameStore Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr body Assign SubscriptStore NameLoad Index Call NameLoad NameLoad NameLoad For NameStore AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If NameLoad body If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body Assign SubscriptStore NameLoad Index AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call NameLoad AttributeLoad NameLoad attr Str NameLoad If CompareIsNot NameLoad NameLoad body Return Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad BinOpAdd BinOpAdd Str AttributeLoad AttributeLoad NameLoad attr attr Str Return Call NameLoad NameLoad decorator_list decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str ImportFrom alias If Call NameLoad NameLoad body Return NameLoad If CompareIsNot NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If CompareIsNot NameLoad NameLoad body Return AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr If CompareEq Call NameLoad NameLoad Num body Return NameLoad If CompareIn Call NameLoad SubscriptLoad NameLoad Index Num TupleLoad NameLoad NameLoad body Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults kwarg body FunctionDef arguments args NameParam defaults body FunctionDef arguments args defaults vararg body Return Call NameLoad NameLoad decorator_list Assign AttributeStore NameLoad attr SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Slice Num AttributeLoad AttributeLoad NameLoad attr attr For TupleStore NameStore NameStore Call NameLoad Call AttributeLoad NameLoad attr body Expr Call NameLoad NameLoad NameLoad NameLoad Return Call NameLoad NameLoad decorator_list Return NameLoad decorator_list FunctionDef arguments args defaults kwarg body Expr Str Return Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return NameLoad decorator_list FunctionDef arguments args defaults kwarg body Return Call NameLoad NameLoad NameLoad decorator_list
N/A N/A Extends the possibilities for defining choices for fields of a
Django model.

- Context-sensitive choices
- Non-limiting choices :
  specify a pick list of suggestions but leave the possibility
  to store manually entered values
- :ref:`learning_combos`

TODO: compare with `django-ajax-selects
<https://github.com/crucialfelix/django-ajax-selects>`_


.. _learning_combos:

Learning Comboboxes
-------------------

Choosers inspect the model, and if it defines a method
`create_FOO_choice`, then the chooser will become "learning": the
ComboBox will be told to accept also new values, and the server will
handle these cases accordingly.

 builtins str builtins object N/A logging N/A logger N/A N/A logging getLogger __name__ lino.utils.instantiator make_converter lino.core constants lino.core.utils getrqdata BaseChooser N/A object N/A N/A N/A FieldChooser N/A BaseChooser N/A __init__ N/A N/A self field N/A N/A N/A N/A self field field N/A N/A ChoicesChooser N/A FieldChooser N/A __init__ N/A N/A self field N/A N/A N/A N/A N/A FieldChooser __init__ self field N/A N/A self simple_values N/A type N/A N/A field choices N/A 0 N/A N/A Chooser N/A FieldChooser N/A N/A A **chooser** holds information about the possible choices of a
    field.

     N/A simple_values False N/A instance_values True N/A force_selection True N/A choice_display_method None N/A can_create_choice False __init__ N/A N/A self model field meth N/A N/A N/A N/A N/A FieldChooser __init__ self field N/A N/A self model model N/A N/A self meth meth lino.core.gfks is_foreignkey N/A N/A N/A is_foreignkey field N/A N/A N/A self simple_values N/A getattr meth simple_values False N/A N/A self instance_values N/A getattr meth instance_values False N/A N/A self force_selection N/A getattr meth force_selection N/A self force_selection N/A N/A self context_params N/A meth context_params N/A N/A self context_values N/A N/A N/A self context_fields N/A N/A name N/A self context_params N/A N/A f N/A N/A self get_data_elem name N/A N/A f None N/A N/A N/A Exception N/A No data element '%s' in %s (method %s_choices) N/A name N/A self model N/A field name N/A N/A N/A N/A self context_fields append f N/A N/A N/A N/A self context_values append N/A name Hidden N/A N/A self converters N/A N/A f N/A self context_fields N/A N/A cv N/A make_converter f N/A N/A cv None N/A N/A N/A N/A N/A self converters append cv N/A N/A hasattr model N/A create_%s_choice N/A field name N/A N/A N/A self can_create_choice True N/A m N/A getattr model N/A %s_choice_display N/A field name None N/A N/A m None N/A N/A N/A self choice_display_method m N/A __str__ N/A N/A self N/A N/A N/A N/A Chooser(%s.%s,%s) N/A N/A N/A self model __name__ N/A N/A self field name N/A self context_params N/A create_choice N/A N/A self obj text N/A N/A N/A m N/A getattr obj N/A create_%s_choice N/A N/A self field name N/A N/A m text N/A get_data_elem N/A N/A self name N/A N/A N/A Calls :meth:`dd.Actor.get_data_elem` or
        :meth:`dd.Model.get_data_elem` or
        :meth:`dd.Action.get_data_elem`.

         N/A de N/A N/A N/A self model get_data_elem name N/A N/A de None N/A N/A N/A N/A N/A self model get_param_elem name N/A de N/A __call__ N/A N/A self N/A args kw N/A N/A N/A i v N/A enumerate args N/A N/A N/A kw N/A N/A N/A self context_fields N/A i v N/A N/A N/A self get_choices kw N/A get_choices N/A N/A self N/A context N/A N/A Return a list of choices for this chooser, using keyword parameters
        as context.

         N/A args N/A N/A varname N/A self context_params N/A N/A N/A N/A args append N/A N/A context get varname None N/A N/A N/A self meth args N/A get_request_choices N/A N/A self request tbl N/A N/A N/A 
        Return a list of choices for this chooser,
        using a HttpRequest to build the context.
         django.contrib.contenttypes.models ContentType N/A kw N/A N/A N/A N/A tbl master_field None N/A N/A rqdata N/A getrqdata request N/A N/A N/A tbl master None N/A N/A master N/A tbl master N/A N/A mt N/A N/A rqdata get N/A constants URL_PARAM_MASTER_TYPE N/A N/A N/A master N/A N/A N/A N/A N/A ContentType objects get pk mt model_class N/A N/A N/A N/A ContentType DoesNotExist N/A N/A master None N/A pk N/A N/A rqdata get N/A constants URL_PARAM_MASTER_PK None N/A N/A pk master N/A N/A N/A N/A N/A kw N/A N/A N/A tbl master_field name N/A N/A N/A master objects get pk pk N/A N/A N/A ValueError N/A N/A N/A Exception Invalid primary key %r for %s pk N/A master __name__ N/A N/A N/A master DoesNotExist N/A N/A N/A Exception N/A There's no %s with primary key %r N/A N/A master __name__ pk N/A N/A k v N/A list N/A N/A N/A request GET items N/A N/A N/A kw N/A N/A str k v N/A cv N/A self converters N/A N/A kw N/A N/A cv convert kw N/A N/A tbl known_values N/A N/A N/A N/A kw update N/A tbl known_values N/A False N/A N/A N/A ar create_kw N/A N/A N/A N/A kw update N/A ar create_kw N/A N/A ar known_values N/A N/A N/A N/A kw update N/A ar known_values N/A N/A tbl master_key N/A N/A N/A kw N/A N/A tbl master_key N/A ar master_instance N/A N/A N/A self get_choices kw N/A get_text_for_value N/A N/A self value obj N/A N/A N/A m N/A getattr N/A self field get_text_for_value None N/A N/A m None N/A N/A N/A m value N/A m N/A getattr obj N/A N/A get_ N/A N/A self field name _display N/A N/A m value N/A N/A uses_simple_values N/A N/A holder fld N/A N/A N/A used by :class:`lino.core.store` lino.core.gfks is_foreignkey N/A N/A is_foreignkey fld N/A N/A False N/A N/A holder None N/A N/A ch N/A N/A holder get_chooser_for_field N/A fld name N/A N/A ch None N/A N/A N/A ch simple_values N/A choices N/A list N/A fld choices N/A N/A N/A len choices 0 N/A N/A True N/A N/A N/A type N/A choices N/A 0 N/A list tuple N/A N/A False N/A True N/A _chooser N/A N/A make N/A options N/A chooser_decorator N/A N/A fn N/A N/A wrapped N/A N/A N/A args N/A N/A N/A fn args N/A N/A N/A wrapped context_params N/A N/A N/A fn __code__ co_varnames N/A 1 N/A N/A fn __code__ co_argcount N/A N/A k v N/A list N/A N/A options items N/A N/A N/A setattr wrapped k v N/A N/A make wrapped N/A N/A chooser_decorator N/A chooser N/A N/A N/A options N/A N/A Decorator which turns the method into a chooser. N/A N/A _chooser classmethod options N/A noop N/A N/A x N/A N/A N/A x N/A action_chooser N/A N/A N/A options N/A N/A N/A _chooser noop options N/A