[1.7.x] Fixed #22982 -- Added GenericRelatedObjectManager.__str__. to prevent crash.
Thanks bendavis78 for the report.
This commit is contained in:
parent
4c56b6f820
commit
29585e9b6a
|
@ -453,6 +453,9 @@ def create_generic_related_manager(superclass):
|
|||
)
|
||||
do_not_call_in_templates = True
|
||||
|
||||
def __str__(self):
|
||||
return repr(self)
|
||||
|
||||
def get_queryset(self):
|
||||
try:
|
||||
return self.instance._prefetched_objects_cache[self.prefetch_cache_name]
|
||||
|
|
|
@ -260,3 +260,7 @@ class GenericRelationTests(TestCase):
|
|||
# where the pre_delete signal should fire and prevent deletion.
|
||||
with self.assertRaises(ProtectedError):
|
||||
related.delete()
|
||||
|
||||
def test_ticket_22982(self):
|
||||
place = Place.objects.create(name='My Place')
|
||||
self.assertIn('GenericRelatedObjectManager', str(place.links))
|
||||
|
|
Loading…
Reference in New Issue