Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: What is 'spec' in filters.html doing? Resolved an issue but not sure if its sustainable #301

Open
eddyojb88 opened this issue Feb 28, 2024 · 1 comment

Comments

@eddyojb88
Copy link

eddyojb88 commented Feb 28, 2024

I am not sure what the speccontext 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?

@lukasvinclav
Copy link
Contributor

@eddyojb88 would you mind to prepare a repo with minimal example which is causing a problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants