tethered my phone to my laptop to test it out...have this code in my template:
{% regroup feeds by feed_type as feed_list %} {% for feed_type in feed_list %} {{ feed_type.grouper }} {% for entry in feed_type.list %} <li>{{ entry.title }}</li> {% endfor %} {% endfor %} it does the first {% for %} loop perfectly, the second {% for %} loop gets the Feed from the database for that FeedType, but I need it to get FeedItems for Feed in FeedType Thanks for any help On Jun 10, 8:54 am, Chris McComas <mccomas.ch...@gmail.com> wrote: > Thanks very much! > > The city is passed to the view as an argument. > > How would I run the regroup? I'm on the road and not around my laptop > for a few hours. > > would it be: > > {% regroup feeds by type as feed_list %} > {% for type by feed_list %} > <h1>{{ type.name }}</h1> > <ul> > {% for entry in feed.list %} > <li>{{ entry.title }}</li> > {% endfor %} > </ul> > {% endfor %} > > On Jun 10, 6:21 am, bruno desthuilliers > > > > > > > > <bruno.desthuilli...@gmail.com> wrote: > > On Jun 10, 6:13 am, Chris McComas <mccomas.ch...@gmail.com> wrote: > > > > I have this views.py and models.py: > > > >http://dpaste.com/552615/ > > > > On the view what I want to do is display a list of all the feed types > > > (News, Sports, etc general categories), then then below each of those > > > feed type headings display the FeedItems for each feed for that city. > > > Which city ? > > > > Prior to adding the City model it was pretty easy, I was able to just > > > do this in my template: > > > >http://dpaste.com/552616/ > > > > Maybe it's because it's late and I'm out of coffee, but this is > > > totally stumping me on how to do this best. Any help would be greatly > > > appreciated! > > > Assuming the city is passed as an argument to the view (dummy code, > > may have a few errors): > > > # views.py > > > def news(request, city_id): > > city = get_object_or_404(City, pk=city_id) > > feeds = Feed.objects.filter(city=city).select_related("type") > > return render_to_response( > > "path/to/template.html", > > dict(city=city, feeds=feeds) > > ) > > > then in you template you just {% regroup %} feeds by > > type,cfhttps://docs.djangoproject.com/en/1.3/ref/templates/builtins/#regroup -- 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.