to
{{{
ordering = [Lower("name")]
}}}
in the Meta class of some models.
Now when I order a related Model, the result is not order as it should be.
Consider the following example:
{{{
class ItemCategory(models.Model):
name = models.CharField(max_length=100)
class Meta:
ordering = [Lower("name")]
class Item(models.Model):
name = models.CharField(max_length=100)
category = models.ForeignKey("ItemCategory", blank=True, null=True,
on_delete=models.CASCADE)
class Meta:
ordering = [Lower("name")]
}}}
If I do `Item.objects.all().order_by("category", "name")` then the results
are ordered by Item name only, not ItemCategory name and Item name as it
should be.
--
Ticket URL: <https://code.djangoproject.com/ticket/34089>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => duplicate
Comment:
Duplicate of #29538, fixed in Django 4.1 (see
2798c937deb6625a4e6a36e70d4d60ce5faac954).
--
Ticket URL: <https://code.djangoproject.com/ticket/34089#comment:1>