invisiWeeble wrote:
> def prods_by_channel(request, slug):
> 
>         try:
>                 ch = Channel.objects.get(slug__iexact=slug)
>                 ct = ch.category_set.all()
>         except Category.DoesNotExist:
>                 raise Http404
> 
>         return list_detail.object_list(
>                 request,
>                 queryset = ct.prod_set.all(),
>                 template_name = "prods/prod_by_channel.html",
>         )
> 
> I know the category_set contains further prod_sets, but I don't know
> how get at them, using the view code above raises an attribute error...

So, "ct" is a list of categories, there is no attribute "prod_set" on it.

However, you can retrieve all products by categories, like this :

    Product.object.filter(categories__in=ct.all())

You can have a look at 
http://www.djangoproject.com/documentation/models/many_to_many/ for more 
informations.

  - Jonathan

ps : no need to specify so much characters in your mail title ...

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to