Ticket #23774: 23774.diff

File 23774.diff, 1.1 KB (added by Tim Graham, 10 years ago)
  • docs/ref/models/querysets.txt

    diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
    index 77f933d..218a4ff 100644
    a b and so on for as many models as you want to join. For example::  
    289289    Entry.objects.order_by('blog__name', 'headline')
    290290
    291291If you try to order by a field that is a relation to another model, Django will
    292 use the default ordering on the related model (or order by the related model's
     292use the default ordering on the related model, or order by the related model's
    293293primary key if there is no :attr:`Meta.ordering
    294 <django.db.models.Options.ordering>` specified. For example::
     294<django.db.models.Options.ordering>` specified. For example, since the ``Blog``
     295model has no default ordering specified::
    295296
    296297    Entry.objects.order_by('blog')
    297298
    primary key if there is no :attr:`Meta.ordering  
    299300
    300301    Entry.objects.order_by('blog__id')
    301302
    302 ...since the ``Blog`` model has no default ordering specified.
     303If ``Blog`` had ``ordering = ['name']``, then the first queryset would be
     304identical to::
     305
     306    Entry.objects.order_by('blog__name')
    303307
    304308.. versionadded:: 1.7
    305309
Back to Top