django-unfold
django-unfold copied to clipboard
Question: What is 'spec' in filters.html doing? Resolved an issue but not sure if its sustainable
I am not sure what the spec
context in filters.html achieves and whether it is problematic when it has no lookup_val, but the existing code breaks my app.
{% for choice in choices %}
{% if choice.selected %}
<input type="hidden" name="{{ spec.lookup_kwarg }}" value="{{ spec.lookup_val.0 }}" />
{% endif %}
{% endfor %}
However, to fix this I overwrote filter.html and included this line instead:
{% for choice in choices %}
**{% if spec.lookup_val %}**
<input type="hidden" name="{{ spec.lookup_kwarg }}" value="{{ spec.lookup_val.0 }}" />
{% endif %}
{% endfor %}
My code now 'works' but it feels a bit magic and I'm not sure if this is sustainable. Are you able to advise?
@eddyojb88 would you mind to prepare a repo with minimal example which is causing a problem?