'Test case for using ForeignKey in multiple databases in Django

In Django, if I specify the key of another scheme's Model as the ForeignKey, I can usually get the object of the ForeignKey automatically. However, why do I get the following error only in testcase? I can find id, but can't get object.

Environment is Django3.0 Postgresql12.

django/db/models/query.py", line 417, in get
self.model._meta.object_name

I tried some solutions. But, I'm still facing the error...

from django.test import TestCase
TestCase.databases = {'default', 'another_db'}
databases = '__all__'
multi_db = True


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source