On Sun, Sep 27, 2009 at 8:41 PM, jeffself <jeff.s...@gmail.com> wrote:
> > Here's my url.py: > > from django.conf.urls.defaults import * > > urlpatterns = patterns('Rankings.college.views', > url(r'^rankings/division/(\w+)/$', 'rankings_by_league'), > ) > > views.py > > def rankings_by_league(request, league): > try: > league = League.objects.get(slug__iexact=league) > except League.DoesNotExist: > raise Http404 > > return list_detail.object_list( > request, > queryset = SchoolSeason.objects.all(), > template_name = "college/rankings_by_league.html", > template_object_name = "rankings", > extra_context = {"league": league} > ) > > rankings_by_league.html > {% extends "base.html" %} > > {% block title %}My rankings {% endblock %} > > {% block content %} > > <h3>2009 {{ league.league_name }} Rankings</h3> > > <ol> > {% for ranking in rankings %} > <li>{{ ranking.school.school_name}} {{ ranking.wins}} > {{ ranking.losses}} {{ ranking.rating}}</li> > {% endfor %} > </ol> > > {% endblock %} > > I've spent my entire Sunday looking at this and can't figure it out. > Only thing that displays is the <h3> tag. > Doc here: http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-list-detail-object-list states that _list will be appended to the value of your template_object_name to create the variable name used in the context. So try iterating through rankings_list. Karen --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---