My question is whether I can compare a filtered template variable to a
string as in "{% ifequal naics.description|slice:"0:1" 'A' %}"

I'm looping through approximately 1800 NAICS description using the
code below. I don't want to output the first "Back to the top" link so
I'm trying to use the "ifequal" or "ifnotequal" tags and the slice
filter.

I'm not sure if I've found a bug or if I'm not understanding these
tags fully.

        {% for naics in queryset %}
                {% ifchanged %}
                <tr>
                        <td style="text-align:left;padding-left:.25em"><a
name="{{ naics.description|slice:"0:1" }}"
class="body"><h3>{{ naics.description|slice:"0:1" }}</h3></a></td>
                        <td style="text-align:right; padding-right:.25em">{% 
ifequal
naics.description|slice:"0:1" 'A' %}&nbsp;{% else %}<a href="#top"
class="body">Back to the top</a>{% endifequal %}</td>
                </tr>
                {% endifchanged %}
  <tr class="{% cycle bodytext,bodyshaded %}">
      <td colspan="2" style="text-align:left;padding-left:.25em">
        <a href="/businesses/business/search/industry/{{ region }}/
{{ hood}}/{{naics.id}}">{{ naics.description }}</a>
      </td>
  </tr>
  {% endfor %}


The above code is NOT catching the first instance of an NAICS
description which begins with "A".


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to