Ticket #9358: 9231-dates-sorting.diff

File 9231-dates-sorting.diff, 527 bytes (added by Mathijs de Bruin, 16 years ago)
  • django/db/models/sql/subqueries.py

    diff --git a/django/db/models/sql/subqueries.py b/django/db/models/sql/subqueries.py
    index 39ef439..bb60010 100644
    a b class DateQuery(Query):  
    397397        self.select_related = False # See #7097.
    398398        self.extra_select = {}
    399399        self.distinct = True
    400         self.order_by = order == 'ASC' and [1] or [-1]
     400        self.order_by = order == 'ASC' and [field.name] or ['-%s' % field.name]
    401401
    402402class CountQuery(Query):
    403403    """
Back to Top