[Answered ]-How turn {{ fieldset.fields }} in Django template into a string?

2👍

✅

It looks like the fields property returns a list that contains two tuples, so you might want to run it through a for loop to check each tuple for the membership of the string ‘nanoadded’

Perhaps like this:

{% for fieldset in adminform %}
    {% for field in fieldset.fields %}
    <li> {{ field }} </li>
        {% if "nanoadded" in field  %}
            <li> nanoadded is here </li>
        {% else %}
            <li> nanoadded is NOT here </li>
        {% endif %}       
    {% endfor %} 
{% endfor %}

Leave a comment