I have a following model.
class Compared(models.Model):
store = models.ForeignKey(Store)
product = models.ForeignKey(Product)
class Meta():
unique_together = ('store', 'product')
And with following type of data in it.
(store, product)
(1, 1)
(2, 1)
(3, 1)
(2, 2)
(2, 3)
(3, 3)
(3, 2)
I want to group by product and get all stores in that group.
(product, (stores))
(1, (1, 2, 3))
(2, (2, 3))
(3, (2, 3))
Is there a built in query function to achieve that or I have to manually make them so?