blow is my database:
class TestCases(TmstafServerModel):
name = models.CharField(max_length=30)
class TestRunSummary(TmstafServerModel):
testResult = models.ForeignKey(TestResult)
testCases = models.ForeignKey(TestCases)
platform = models.ForeignKey(Platform)
I want to get data order by testcase’s name, such as:
all_fail_case = TestRunSummary.objects.all().order_by('testCases.name')
but it not work, how can i get all records in TestRunSummary which ordering by testCases name?
thanks:)
Use
__instead of.like described in the documentation. Alternatively you can also specify a default ordering for the TestCase model and sort bytestCases.