mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #33816 -- Fixed QuerySet.only() after select_related() crash on proxy models.
This commit is contained in:
@@ -395,6 +395,12 @@ class ProxyModelTests(TestCase):
|
||||
p = MyPerson.objects.get(pk=100)
|
||||
self.assertEqual(p.name, "Elvis Presley")
|
||||
|
||||
def test_select_related_only(self):
|
||||
user = ProxyTrackerUser.objects.create(name="Joe Doe", status="test")
|
||||
issue = Issue.objects.create(summary="New issue", assignee=user)
|
||||
qs = Issue.objects.select_related("assignee").only("assignee__status")
|
||||
self.assertEqual(qs.get(), issue)
|
||||
|
||||
def test_eq(self):
|
||||
self.assertEqual(MyPerson(id=100), Person(id=100))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user