Thursday, December 18, 2014

change_list html template filter block inject a css class

Hi,

the following block of code is an excerpt from change_list.html template:

{% block filters %}
        {% if cl.has_filters %}
          <div id="changelist-filter">
            <h2>{% trans 'Filter' %}</h2>
           


            {% for spec in cl.filter_specs %}
              {% if "somefilter" in spec|slugify %} <!-- The condition works in my project -->
                <div class="tag_type">{% admin_list_filter cl spec %}</div> <!-- This is how I add a new class, is there a simpler way to append a class attribute? -->
             
              {% else %}
                {% admin_list_filter cl spec %}
              {% endif %}

            {% endfor %}
          </div>
        {% endif %}
      {% endblock %}

What I'm looking for is to format some <li >'s based on given conditions.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/754b0df2-2fe6-4ac7-8002-52314f808ac2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment