Ticket #10352: 10352-test.diff

File 10352-test.diff, 652 bytes (added by Glenn, 6 years ago)
  • tests/regressiontests/queries/models.py

     
    10441044>>> Annotation.objects.filter(notes__in=Note.objects.filter(note="n1").values_list('note').values('id'))
    10451045[<Annotation: a1>]
    10461046
     1047Bug #10352: Query.as_sql() breaks annotations
     1048>>> from django.db.models import Count
     1049>>> test = Item.objects.annotate(cnt=Count("id"))
     1050>>> test.as_sql()
     1051>>> test[0].cnt
     10521
     1053
    10471054"""}
    10481055
    10491056# In Python 2.3 and the Python 2.6 beta releases, exceptions raised in __len__
Back to Top