0

我有两个模型:

class Contact(models.Model):
    name = models.CharField(max_length=255)

class Campaign(models.Model):
    contact = models.ForeignKey(Contact, related_name="campaigns")
    name = models.CharField(max_length=255)

如何在 Campaign 表中选择所有具有 Campaign name='CampaignName' 的联系人?

4

1 回答 1

1
Contact.objects.filter(campaign__name='CampaignName')
于 2012-06-15T13:17:14.593 回答