I don't understand why my template_object_name is empty in a generic
object_list view. I'm trying to grab all the category names and urls
from my Category model but it's turning up empty, at least
{{ category_list|length }} yields 0. I'm trying to add this info to
the sidebar of a generic object_list view for art projects, so I'm
giving the view the template_name and the template_object_name to
avoid confusion with the generic view it will be included in - already
using the default object_list and app/model_list.html for the main
content. Thanks for any help.

# URL #
from django.conf.urls.defaults import *
from project.models import Category

project_info_dict = {
    'queryset': Category.objects.all(),
    'template_name': 'portfolioproject_list.html',
    'template_object_name': 'category',
}

urlpatterns = patterns('',
    (r'^$', 'django.views.generic.list_detail.object_list',
project_info_dict, 'category_list'),
    (r'^(?P<slug>[-\w]+)/$', 'project.views.category_detail', {},
'category_detail'),
)

# TEMPLATE #

{% block sidebar %}
<h3>Categories</h3>
<ul>
{% for category in category_list %}
<li>
<a href="{{ category.get_absolute_url }}">{{ category }}</a>
</li>
{% endfor %}
</ul>
{% endblock %}

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

Reply via email to