Closed joke2k closed 4 years ago
To render the field ?
Debugging it seems to be always empty. The field is rendered with the row above as a widget.
I'm using pytest-django
and I want to permanently activate the FAIL_INVALID_TEMPLATE_VARS option. It actually did help me find a couple of minor bugs in my app.
Problem is: it also finds this spec.field
, as it cannot limit itself to a specific app/directory. If it's always empty/unused, I think we can just drop the line (#96).
As a workaround, I just locally (__one_of_my_apps__/templates/django-admin-autocomplete-filter/autocomplete-filter.html
) re-implemented the template as:
{% load i18n %}
{% if not spec.is_placeholder_title %}
<h3>{% blocktrans with filter_title=title %} By {{ filter_title }} {% endblocktrans %}</h3>
{% endif %}
<ul>
<li>{{ spec.rendered_widget }}</li>
</ul>
Everything seem to work as expected
Looking at the code, the right attribute may be form_field
, or the code need to be changed from field = self.form_field(...)
to self.field = self.form_field(...)
No, tested both and they don’t render anything useful.
The first li
element contains what is necessary to have the autocomplete filter working.
We need that?
https://github.com/farhan0581/django-admin-autocomplete-filter/blob/64c750ffb4be8fc642df5caba639095fab6f2826/admin_auto_filters/templates/django-admin-autocomplete-filter/autocomplete-filter.html#L7