2
타격 내 데이터베이스입니다 : 내가 모든 기록에서 얻을 수있는 방법을장고 순서의 문제
all_fail_case = TestRunSummary.objects.all().order_by('testCases.name')
하지만이 작동하지 :
class TestCases(TmstafServerModel):
name = models.CharField(max_length=30)
class TestRunSummary(TmstafServerModel):
testResult = models.ForeignKey(TestResult)
testCases = models.ForeignKey(TestCases)
platform = models.ForeignKey(Platform)
내가 같은 테스트 케이스의 이름으로 데이터 순서를 얻으려면 TestRunSummary testCases 이름으로 주문 하시겠습니까? 감사합니다 :)
고맙습니다! TestRunSummary.objects.all()을 사용하지 않는 이유는 무엇입니까? order_by ('testCases__name') 주문 상태이므로 all() 후 order_by()를 쓰는 것이 옳습니다. 감사합니다! – LoveTW
@Yuan - 중복 적입니다 -'all'은 단지'QuerySet'을 가지고 있어야만 유용합니다 (http://docs.djangoproject.com/en/dev/ref/models/querysets/#all에있는 문서를 참조하십시오).) –
대단히 감사합니다! :) – LoveTW