Ticket #10132: 10132-test.diff

File 10132-test.diff, 832 bytes (added by Glenn Maynard, 15 years ago)
  • tests/regressiontests/queries/models.py

     
    10281028>>> Annotation.objects.filter(notes__in=Note.objects.filter(note="n1").values_list('note').values('id'))
    10291029[<Annotation: a1>]
    10301030
     1031Bug #10132 -- QuerySet values() should work on extra(select) fields
     1032>>> from django.db.models import Count
     1033>>> test = Item.objects.extra(select={"note_alias": "note_id"}).values("note_alias")
     1034>>> test.order_by("note_alias").annotate(Count("id"))
     1035[{'note_alias': 1, 'id__count': 2}, {'note_alias': 2, 'id__count': 1}, {'note_alias': 3, 'id__count': 3}]
     1036
    10311037"""}
    10321038
    10331039# In Python 2.3 and the Python 2.6 beta releases, exceptions raised in __len__
Back to Top