for sake of simplicity, let's have following models:
class tag(models.model): name = models.charfield(max_length=255) class supplier(models.model): name = models.charfield(max_length=90) tags = models.manytomany(tag, null=true, blank=true)
i have list of liked
suppliers , have tags suppliers have. how can tags contained in list of suppliers?
you can use __in
.
tag.objects.filter(supplier__in=list_of_suppliers)