Hi everyone,

Still wet behind the ears with Django, so please bear with me...

In my model, I have categories and items. Each item belongs to a
category. When I run the admin app, I can see my categories, and I can
see my products. I have visually verified that each item has a foreign
key for the category id.

In my view, I am retrieving the categories as such:

def showCategories(request):
    categories = Category.objects.all().select_related()
    return render_to_response('showCategories.html',{'categories':
categories})


In my template, I have:

{% for category in categories %}
    <h2>{{ category.title }}</h2>
    <ul>
    {% for item in work_category.items %}
        <li>{{ item.name }}</li>
    {% endfor %}
    </ul>
{% endfor %}


I get categories, but no items. When I display a count of the items:

{{ category.items|length }}

I get 0. What am I doing wrong? Any help greatly appreciated!
--~--~---------~--~----~------------~-------~--~----~
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