[Fixed]-Django model serialization only returns primary key for foreign key

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 the natural_key() method to serialize any foreign key reference to objects of the type that defines the method.

👤AKS

Leave a comment