Product is not linked to them - they are linked to Product. I do not
think you can do it in one query because there are ManyToMany fields
which have to be retrieved and then you have to iterate over them.
Certainly more than one query.

On Tue, 2011-03-29 at 00:24 -0700, gontran wrote:
> Yes: ProductLicence and News
> 
> On 29 mar, 09:19, Kenneth Gonsalves <law...@thenilgiris.com> wrote:
> > On Tue, 2011-03-29 at 00:11 -0700, gontran wrote:
> > > UserProfile(models.Model):
> > >     user = models.OneToOneField(User)
> > >     company = models.ForeignKey(Company)
> >
> > > Company(models.Model):
> > >     product_licences = models.manyToManyField(ProductLicence)
> >
> > > Product(models.Model):
> > >     ...some fields...
> >
> > > ProductLicence(models.Model):
> > >     product = models.ForeignKey(Product)
> >
> > > News(models.Model):
> > >    related_products = models.ManyToManyField(Product)
> >
> > > I already know how to retrieve all distinct products for which the
> > > company of the user owns licences, but now, what I want to do is to
> > > retrieve all news, for a given user, that are related to products, for
> > > which the company of the user owns licences.
> >
> > Product is not linked to any model?
> > --
> > regards
> > KGhttp://lawgon.livejournal.com
> > Coimbatore LUG roxhttp://ilugcbe.techstud.org/
> 


-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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

Reply via email to