Ticket #7302: 7302.1.diff
File 7302.1.diff, 1.2 KB (added by , 16 years ago) |
---|
-
django/db/models/sql/query.py
629 629 result.append('%s %s' % (elt, order)) 630 630 else: 631 631 col, order = get_order_dir(field, asc) 632 elt = qn (col)632 elt = qn2(col) 633 633 if distinct and elt not in select_aliases: 634 634 ordering_aliases.append(elt) 635 635 result.append('%s %s' % (elt, order)) -
tests/modeltests/ordering/models.py
77 77 # take the first two). 78 78 >>> Article.objects.all().reverse()[:2] 79 79 [<Article: Article 1>, <Article: Article 3>] 80 81 # Ordering with 'extra' properly quotes aliases to not clash with SQL keywords 82 >>> Article.objects.extra(select={'order': 'pub_date'}, order_by=['order', 'headline']) 83 [<Article: Article 1>, <Article: Article 2>, <Article: Article 3>, <Article: Article 4>] 80 84 """}