I have the following Django models.
class A(models.Model):
tmp = models.ForeignKey(B)
active = models.BooleanField()
class B(models.Model):
active = models.BooleanField()
archived = models.BooleanField()
Now I have the following query.
A.objects.select_related(B).filter(active=True)
Now this fetches all the objects of B. Now how can I include a filter of active=True
and archived=False
in the select_related
clause for model B
.