Ticket #7302: 7302.diff

File 7302.diff, 651 bytes (added by toke-djangp@…, 7 years ago)

Simple fix without tests

  • django/db/models/sql/query.py

     
    601601                # on verbatim.
    602602                col, order = get_order_dir(field, asc)
    603603                table, col = col.split('.', 1)
    604                 elt = '%s.%s' % (qn(table), col)
     604                elt = '%s.%s' % (qn(table), qn2(col))
    605605                if not distinct or elt in select_aliases:
    606606                    result.append('%s %s' % (elt, order))
    607607            elif get_order_dir(field)[0] not in self.extra_select:
Back to Top