lookup which searchs models based on a particular field. Let's define a simple model:
.. literalinclude:: ../example/core/models.py
In a `lookups.py` we will define our lookup:
.. literalinclude:: ../example/core/lookups.py
This lookups extends `selectable.base.ModelLookup` and defines two things: one is
the model on which we will be searching and the other is the field which we are searching.
Below this definition we will register our lookup class.
- .. literalinclude:: ../example/core/lookups.py
Now that we have a working lookup we will define a form which uses it:
.. literalinclude:: ../example/core/forms.py
+ :end-before: newautocomplete
This replaces the default widget for the `CharField` with the `AutoCompleteWidget`.
This will allow the user to fill this field with values taken from the names of