Re: ManyToMany lookups

2009-10-21 Thread koenb
On 20 okt, 21:19, r_f_d wrote: > Why not do this: > > for p in products.objects.all(): >     for c in p.categories.all(): >          print p,' - ', c > > -richard > > On Oct 20, 7:57 am, Михаил Лукин wrote: > This will obviously leave you with a

Re: ManyToMany lookups

2009-10-20 Thread r_f_d
Why not do this: for p in products.objects.all(): for c in p.categories.all(): print p,' - ', c -richard On Oct 20, 7:57 am, Михаил Лукин wrote: > As I know, each category has attribute product_set > > 2009/10/20 ausi1972

Re: ManyToMany lookups

2009-10-20 Thread Михаил Лукин
As I know, each category has attribute product_set 2009/10/20 ausi1972 > > I am trying to work out how to construct a queryset that contains > multiple records for a ManyToMany field. > > The models are like this: > class products(models.Model) >name =

ManyToMany lookups

2009-10-20 Thread ausi1972
I am trying to work out how to construct a queryset that contains multiple records for a ManyToMany field. The models are like this: class products(models.Model) name = models.CharField() categories = models.ManyToManyField(Category) class category(models.Model) name =