Django filter relation model mutiple fields at the sime time

I have a problem to filter following condition:

`class Plan(models.Model): name = models.CharField(max_length=50)

class PlanAttribute(models.Model): plan = models.ForeignKey(Plan, on_delete=models.CASCADE, related_name="attributes") key = models.CharField(max_length=50) value = models.CharField(max_length=50)`

I want to filter Plan with attr key="key1" and value="value1" at the same time Plan.objects.filter(attributes__key="key1", attributes__value="value1") is not what I want

Please help me to filter like this cases

Back to Top