Making Django-Jet autocomplete with TabularInlines
My team used "django-jet" as admin skin in our django application.
We have rows with very large selection widgets, as the django-jet documentation recommends, we have added fields autocomplete
to our models.
The problem is that it doesn't support TabularInlines. By checking the django-jet code, you can see how to change how the widget works:
- Copy Django admin "
tabular.html
" into your templates. - Load
jet_tags
in the first line. - Add filter
jet_select2_lookup
to fields.
tabular.html
1 {% load i18n admin_urls static admin_modify jet_tags %}
...
...
55 {% if field.is_readonly %}
56 <p>{{ field.contents }}</p>
57 {% else %}
58 {{ field.field.errors.as_ul }}
59 {{ field.field|jet_select2_lookups }}
60 {% endif %}
This approach works to add an autocomplete widget, but it fails with an "wrong option" error.
At the same time, the widget does not seem to use the method formfield_for_foreignkey
defined in admin, so the request is not filtered.
Has anyone successfully added autocomplete to TabularInline using django-jet?
source to share
No one has answered this question yet
Check out similar questions: