I have two models which look like the following:
class Subject(models.Model): subject_code = models.CharField(max_length=12, unique=True) name = model
Can you try with this query:
retrieved_sub = Subject_assessment.objects.filter(subject_code__in=Subject.objects.filter(subject_code=qry_subject_code),year='2014').all()