Hi, if Your code looks like this: class Category(models.Model): name = models.CharField(maxlength=32) pass
class Goods(models.Model): categories = models.ManyToManyField(Category, on_delete=models.CASCADE) You would get it with this code: category = Category.objects.get(pk=23) goods = category.goods_set.all() - it returns queryset of instances, which depends on category with pk=23. Or like that: item = Goods.objects.get(pk=1) categories = item.categories. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/efad969d-1311-4570-a4b8-ace51d9e8cea%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.