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
<[email protected]> wrote:
> On Jun 10, 6:13 am, Chris McComas <[email protected]> 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 [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.