Changes between Initial Version and Version 2 of Ticket #29538


Ignore:
Timestamp:
Jul 3, 2018, 9:40:31 AM (6 years ago)
Author:
Tim Graham
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29538

    • Property Cc wilhelmhb added
    • Property Triage Stage UnreviewedAccepted
    • Property Summary QueryExpression in ordering of a related object failsQuery Expression in ordering of a related object fails
  • Ticket #29538 – Description

    initial v2  
    1111
    1212    class Meta:
    13         ordering = [models.F('instrument').asc(null_last=True)]
     13        ordering = [models.F('instrument').asc(nulls_last=True)]
    1414
    1515class Album(models.Model):
     
    2222        ordering = ['artist']
    2323}}}
    24 fails with {{{ TypeError: 'OrderBy' does not support indexing }}}
     24{{{
     25>>> Album.objects.all()
     26...
     27TypeError: 'OrderBy' does not support indexing
     28}}}
    2529
    2630When reaching [https://github.com/django/django/blob/master/django/db/models/sql/compiler.py#L669], the compiler tries to use the related model, but at line 679, {{{item}}} can be an OrderBy object. Thus the failure.
Back to Top