app.Stock: (models.E015) 'ordering' refers to the nonexistent field,
related field, or lookup 'supply__product__parent__isnull'.
}}}
However this ordering works fine:
{{{
>>>
list(Stock.objects.order_by('supply__product__parent__isnull').values_list('pk',
flat=True)[:5])
[1292, 1293, 1300, 1295, 1294]
>>>
list(Stock.objects.order_by('-supply__product__parent__isnull').values_list('pk',
flat=True)[:5])
[108, 109, 110, 23, 107]
}}}
I believe it was fine until #29408 was implemented.
`Stock.supply` is a foreign key to `Supply`, `Supply.product` is a foreign
key to `Product`, `Product.parent` is a `ForeignKey('self',
models.CASCADE, null=True)`
--
Ticket URL: <https://code.djangoproject.com/ticket/31538>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => assigned
* severity: Normal => Release blocker
* cc: Hasan Ramezani (added)
* owner: nobody => felixxm
* stage: Unreviewed => Accepted
Comment:
Thanks for the report, it's related with using lookup that are not
transforms, e.g. `isnull`
{{{
def test_ordering_pointing_to_lookup_not_transform(self):
class Model(models.Model):
test = models.CharField(max_length=100)
class Meta:
ordering = ('test__isnull',)
self.assertEqual(Model.check(), [])
}}}
Regression in 440505cb2cadbe1a5b9fba246bcde6c04f51d07e.
--
Ticket URL: <https://code.djangoproject.com/ticket/31538#comment:1>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/12858 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/31538#comment:2>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"b73e66e75802f10cc34d4880714554cea54dbf49" b73e66e]:
{{{
#!CommitTicketReference repository=""
revision="b73e66e75802f10cc34d4880714554cea54dbf49"
Fixed #31538 -- Fixed Meta.ordering validation lookups that are not
transforms.
Regression in 440505cb2cadbe1a5b9fba246bcde6c04f51d07e.
Thanks Simon Meers for the report.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31538#comment:3>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"fdd5eb4309535bf49b3138e0954c6da553c1adef" fdd5eb43]:
{{{
#!CommitTicketReference repository=""
revision="fdd5eb4309535bf49b3138e0954c6da553c1adef"
[3.0.x] Fixed #31538 -- Fixed Meta.ordering validation lookups that are
not transforms.
Regression in 440505cb2cadbe1a5b9fba246bcde6c04f51d07e.
Thanks Simon Meers for the report.
Backport of b73e66e75802f10cc34d4880714554cea54dbf49 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31538#comment:4>