Filtered Nested Relationships Django Rest Framework

前端 未结 2 1947
时光说笑
时光说笑 2021-01-20 22:15

I have two models which look like the following:

class Subject(models.Model):

   subject_code = models.CharField(max_length=12, unique=True)
   name = model         


        
2条回答
  •  孤街浪徒
    2021-01-20 22:27

    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()
    

提交回复
热议问题