My models:
class ItemSet(models.Model):
name = models.CharField(max_length=30)
item = models.ManyToManyField(Item)
order = models.IntegerField(default=0)
class Item(models.Model):
name = models.CharField(max_length=30)
desc = models.CharField(max_length=100)
A set includes many items and a item can be in many sets. So, how to get a list of items when we know the id of a item in some sets but itself? Please give me some codes. Thank you very much!
Example: We have two sets like this: (1,2,3,4) and (2,3,5,7,9), id = 3 then result = (1,2,4,5,7,9). Note: result does not include 3.