Ticket #10163: 10163.diff
File 10163.diff, 903 bytes (added by , 16 years ago) |
---|
-
django/forms/models.py
387 387 qs = self.queryset 388 388 else: 389 389 qs = self.model._default_manager.get_query_set() 390 qry = getattr(qs, 'query', None) 391 if qry: 392 ordered = False 393 if qry.extra_order_by: 394 ordered = True 395 elif not qry.default_ordering: 396 ordered = qry.order_by 397 else: 398 ordered = qry.order_by or qry.model._meta.ordering 399 if not ordered: 400 qs = qs.order_by(self.model._meta.pk.name) 390 401 if self.max_num > 0: 391 402 self._queryset = qs[:self.max_num] 392 403 else: