Hi everyone,
i use django for a small fun website, and it's really fun to create
applications with it. Now i'm stuck with a behaviour i can't
comprehend.
I have a category list in my base template :
------[snip]----------------------------------------------------------
{% if categorylist %}
<h1><a href="/">Buckets</a></h1>
<div id="navi_categories">
<ul>
{% for catetory in categorylist %}
<li><a href="{{ catetory.get_absolute_url }}">{% ifequal
category.name active_category %}<b>{% endifequal %}{{ catetory.name
}}{% ifequal category.name active_category %}</b>{% endifequal
%}</a></li>
<!-- <li>{{ active_category }} == {{ catetory.name }} ??</li> -->
{% endfor %}
</ul>
</div>
{% endif %}
------[snip]----------------------------------------------------------
categorylist and active_category are supplied by a context processor
named categorylist :
------[snip]----------------------------------------------------------
def categorylist(request):
active_category = None
if hasattr (request, "session"):
if "category" in request.session:
try:
active_category = Category.objects.get
(pk=request.session['category'])
except:
active_category = None
c = Category.objects.all()
return { 'categorylist' : c, 'active_category' : active_category}
------[snip]----------------------------------------------------------
Both the category list and the active category appear in the template,
and the values are right. What fails is the ifequal statement in the
base template. The <b></b> tags appear in the output if {{
active_category }} is None. If i choose a category the ifequal test
fails even if both values are the same.
Any Ideas?
TIA
Sven
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---