Bruno,
Thanks. It wasn't exactly working properly, so I just had to
add .order_by('feed__feed_type__order_by') and it seems to be working
properly.
On Jun 10, 3:33 pm, bruno desthuilliers
<[email protected]> wrote:
> On 10 juin, 17:23, Chris McComas <[email protected]> wrote:
>
> > Sorry for the confusion, this is what I am trying to achieve. It's the
> > FeedType and then FeedItems whose feed (fk) has a (fk) to FeedType.
>
> > The HTML would be:
>
> > {% for feed_type in FeedType %}
> > <h1>{{ feed_type.name</h1>
> > <ul>
> > {% for FeedItem in Feed in FeedType %}
> > <li>{{ feeditem.title }}</li>
> > </ul>
> > {% endfor %}
>
> Ok.
>
> Then you need to correct your view:
>
> # views.py
>
> def news(request, city_id):
> city = get_object_or_404(City, pk=city_id)
> feeditems =
> FeedItem.objects.filter(feed__city=city).select_related(depth=2)
> return render_to_response(
> "path/to/template.html",
> dict(city=city, feeditems=feeditems)
> )
>
> And then in your template:
>
> {% regroup feeditems by feed_type as feeditems_list %}
> <ul>
> {% for feed_type in feeditems_list %}
> <li>
> {{ feed_type.grouper }}
> <ul>
> {% for entry in feed_type.list %}
> <li>{{ entry.title }}</li>
> {% endfor %}
> </ul>
> </li>
> {% endfor %}
> </ul>
>
> Obviously untested code, but this should work or, at least, get you
> started.
--
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.