1👍
✅
json_shows = serializers.serialize('json', get_all_shows, use_natural_foreign_keys=True)
As stated in the documentation, you will need to specify use_natural_foreign_keys=True
while serializing.
When
use_natural_foreign_keys=True
is specified, Django will use thenatural_key()
method to serialize any foreign key reference to objects of the type that defines the method.
👤AKS
Source:stackexchange.com