#36183: Model o2o inheritance with abstract models does not "evaluate" a lazy
relationship
-------------------------------------+-------------------------------------
Reporter: BeryCZ | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):
* stage: Unreviewed => Accepted
Comment:
I think we can accept a ticket here.
With the following regression test for the git bisect, I bisected the
regression to 513948735b799239f3ef8c89397592445e1a0cd5 (#31426)
{{{#!diff
--- a/tests/model_inheritance_regress/test_regress.py
+++ b/tests/model_inheritance_regress/test_regress.py
@@ -0,0 +1,27 @@
+from django.db import models
+from django.test import TestCase
+
+from .models import Place
+
+
+
+class ParkingLot4(models.Model):
+ # Test parent_link connector can be discovered in abstract classes.
+ parent = models.OneToOneField("Place", models.CASCADE,
parent_link=True)
+
+ class Meta:
+ abstract = True
+
+
+class ParkingLot4C(ParkingLot4, Place):
+ pass
+
+
+class RegressTest(TestCase):
+ def test_use_explicit_o2o_to_parent_from_abstract_model(self):
+ self.assertEqual(ParkingLot4C._meta.pk.name, "parent")
+ ParkingLot4C.objects.create(
+ name="Parking4A",
+ address='21 Jump Street',
+ )
+ ParkingLot4C.objects.order_by("name").all()
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36183#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019538561d12-50fcc575-25fe-486e-856a-55b0cd6592bb-000000%40eu-central-1.amazonses.com.