Changes between Initial Version and Version 1 of Ticket #35309, comment 5


Ignore:
Timestamp:
Mar 16, 2024, 12:35:31 AM (8 months ago)
Author:
Laurent Lyaudet

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35309, comment 5

    initial v1  
    11I spent my night on it but I was able to make a patch, and I don't think there will be any regression.
    22Consider the following models in some project TestNoOrderByForForeignKeyPrefetches and some app test_no_order_by models.py file:
     3
     4{{{#!python
     5from django.db import models
     6
     7class A(models.Model):
     8    name = models.CharField(max_length=200)
     9
     10    class Meta:
     11        ordering = ["name"]
     12
     13
     14class B(models.Model):
     15    name = models.CharField(max_length=200)
     16    a = models.ForeignKey(A, related_name="bs", on_delete=models.CASCADE)
     17
     18    class Meta:
     19        ordering = ["name"]
     20
     21}}}
     22
     23Then consider the following command TestNoOrderByForForeignKeyPrefetches/test_no_order_by/management/commands/test_no_order_by_command.py :
    324
    425{{{#!python
Back to Top