considering the folowing models:
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.
Is it possible to do it with a single query?
Thank you for your time,
regards,
Gontran
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment