Issue #373 : Fix bug with get_real_instances on empty base_result_objects
parent
26fac56e31
commit
f06a02a3d0
|
|
@ -474,7 +474,7 @@ class PolymorphicQuerySet(QuerySet):
|
|||
:rtype: PolymorphicQuerySet
|
||||
"""
|
||||
"same as _get_real_instances, but make sure that __repr__ for ShowField... creates correct output"
|
||||
if not base_result_objects:
|
||||
if base_result_objects is None:
|
||||
base_result_objects = self
|
||||
olist = self._get_real_instances(base_result_objects)
|
||||
if not self.model.polymorphic_query_multiline_output:
|
||||
|
|
|
|||
|
|
@ -332,6 +332,14 @@ class PolymorphicTests(TransactionTestCase):
|
|||
transform=lambda o: o.__class__,
|
||||
)
|
||||
|
||||
# from empty list
|
||||
objects = Model2A.objects.get_real_instances([])
|
||||
self.assertQuerysetEqual(
|
||||
objects,
|
||||
[],
|
||||
transform=lambda o: o.__class__,
|
||||
)
|
||||
|
||||
def test_translate_polymorphic_q_object(self):
|
||||
self.create_model2abcd()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue