Changes between Initial Version and Version 2 of Ticket #29538
- Timestamp:
- Jul 3, 2018, 9:40:31 AM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #29538
- Property Cc added
- Property Triage Stage Unreviewed → Accepted
- Property Summary QueryExpression in ordering of a related object fails → Query Expression in ordering of a related object fails
-
Ticket #29538 – Description
initial v2 11 11 12 12 class Meta: 13 ordering = [models.F('instrument').asc(null _last=True)]13 ordering = [models.F('instrument').asc(nulls_last=True)] 14 14 15 15 class Album(models.Model): … … 22 22 ordering = ['artist'] 23 23 }}} 24 fails with {{{ TypeError: 'OrderBy' does not support indexing }}} 24 {{{ 25 >>> Album.objects.all() 26 ... 27 TypeError: 'OrderBy' does not support indexing 28 }}} 25 29 26 30 When 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.