summaryrefslogtreecommitdiff
path: root/tests/aggregation_regress/models.py
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2015-05-05 14:44:33 +0300
committerTim Graham <timograham@gmail.com>2015-05-11 11:52:14 -0400
commitd5ce2dd7bc5b797d2e338c4bc6e6f3e339b748e5 (patch)
tree584dfffad7ce06e14634a1ed9c3b6613fa222527 /tests/aggregation_regress/models.py
parent056a91dbfae9e741cd4bf033d3062d3d35ff4d90 (diff)
[1.8.x] Fixed #24748 -- Fixed incorrect GROUP BY on MySQL in some queries
When the query's model had a self-referential foreign key, the compiler.get_group_by() code incorrectly used the self-referential foreign key's column (for example parent_id) as GROUP BY clause when it should have used the model's primary key column (id). Backport of adc57632bc26cc8fe42bdb6aff463f883214980a from master
Diffstat (limited to 'tests/aggregation_regress/models.py')
-rw-r--r--tests/aggregation_regress/models.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/aggregation_regress/models.py b/tests/aggregation_regress/models.py
index 2cad0a5486..4d675952c2 100644
--- a/tests/aggregation_regress/models.py
+++ b/tests/aggregation_regress/models.py
@@ -104,3 +104,8 @@ class Bravo(models.Model):
class Charlie(models.Model):
alfa = models.ForeignKey(Alfa, null=True)
bravo = models.ForeignKey(Bravo, null=True)
+
+
+class SelfRefFK(models.Model):
+ name = models.CharField(max_length=50)
+ parent = models.ForeignKey('self', null=True, blank=True, related_name='children')