[1.1.X] Fixed #13360: For Python2.3 compatbility, don't pass iterators to sorted.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12994 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Karen Tracey 2010-04-16 15:47:06 +00:00
parent e7ef1b220e
commit f6b6e0f1d9
2 changed files with 3 additions and 3 deletions

View File

@ -191,7 +191,7 @@ u'The Definitive Guide to Django: Web Development Done Right'
# Calling values on a queryset that has annotations returns the output
# as a dictionary
>>> [sorted(o.iteritems()) for o in Book.objects.filter(pk=1).annotate(mean_age=Avg('authors__age')).values()]
>>> [sorted(o.items()) for o in Book.objects.filter(pk=1).annotate(mean_age=Avg('authors__age')).values()]
[[('contact_id', 1), ('id', 1), ('isbn', u'159059725'), ('mean_age', 34.5), ('name', u'The Definitive Guide to Django: Web Development Done Right'), ('pages', 447), ('price', Decimal("30...")), ('pubdate', datetime.date(2007, 12, 6)), ('publisher_id', 1), ('rating', 4.5)]]
>>> Book.objects.filter(pk=1).annotate(mean_age=Avg('authors__age')).values('pk', 'isbn', 'mean_age')
@ -203,7 +203,7 @@ u'The Definitive Guide to Django: Web Development Done Right'
# An empty values() call before annotating has the same effect as an
# empty values() call after annotating
>>> [sorted(o.iteritems()) for o in Book.objects.filter(pk=1).values().annotate(mean_age=Avg('authors__age'))]
>>> [sorted(o.items()) for o in Book.objects.filter(pk=1).values().annotate(mean_age=Avg('authors__age'))]
[[('contact_id', 1), ('id', 1), ('isbn', u'159059725'), ('mean_age', 34.5), ('name', u'The Definitive Guide to Django: Web Development Done Right'), ('pages', 447), ('price', Decimal("30...")), ('pubdate', datetime.date(2007, 12, 6)), ('publisher_id', 1), ('rating', 4.5)]]
# Calling annotate() on a ValuesQuerySet annotates over the groups of

View File

@ -174,7 +174,7 @@ FieldError: Cannot resolve keyword 'foo' into field. Choices are: authors, conta
{'number': 1132, 'select': 1132}
# Regression for #10064: select_related() plays nice with aggregates
>>> sorted(Book.objects.select_related('publisher').annotate(num_authors=Count('authors')).values()[0].iteritems())
>>> sorted(Book.objects.select_related('publisher').annotate(num_authors=Count('authors')).values()[0].items())
[('contact_id', 8), ('id', 5), ('isbn', u'013790395'), ('name', u'Artificial Intelligence: A Modern Approach'), ('num_authors', 2), ('pages', 1132), ('price', Decimal("82.8...")), ('pubdate', datetime.date(1995, 1, 15)), ('publisher_id', 3), ('rating', 4.0)]
# Regression for #10010: exclude on an aggregate field is correctly negated