Ticket #7058: test_case_sql.diff

File test_case_sql.diff, 656 bytes (added by ikelly, 7 years ago)
  • regressiontests/queries/models.py

     
    473473>>> Ranking.objects.extra(tables=['django_site'], order_by=['-django_site.id', 'rank'])
    474474[<Ranking: 1: a3>, <Ranking: 2: a2>, <Ranking: 3: a1>]
    475475
    476 >>> qs = Ranking.objects.extra(select={'good': 'rank > 2'})
     476>>> qs = Ranking.objects.extra(select={'good': 'case when rank > 2 then 1 else 0 end'})
    477477>>> [o.good for o in qs.extra(order_by=('-good',))] == [True, False, False]
    478478True
    479479>>> qs.extra(order_by=('-good', 'id'))
Back to Top