this is maybe simple but I can't succeed in making a query.
here is my model:
class Client(models.Model):
user = models.OneToOneField(User)
product_licence = models.ManyToManyField('ProductLicence',
blank=True, null=True)
class ProductLicence(models.Model):
product = models.ForeignKey('Produit')
class Product(models.Model):
code = models.CharField(max_length=15)
name = models.CharField(max_length=50)
In my model, clients may buy licences for different products.
I'm trying to get in one query all products for which a given client
owns a licence.
Is it possible to do it or should I make 2 queries?
Thanks in advance
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