[Fixed]-How to show data from joined tables in DJANGO DRF

1👍

You are asking Django Rest Framework to return the primary key of the related object in PromotionSerializer by using PrimaryKeyRelatedField.

If you want it to return the unicode representation of the object, try using StringRelatedField instead: http://www.django-rest-framework.org/api-guide/relations/#stringrelatedfield.

In addition, as one of your comments mentions, you should not use many=True (no need to set it to false, just remove the argument).

Note: It’s unconventional to use Title Case when naming attributes of classes in Python. Title case is normally reserved for class names themselves.

👤ChidG

Leave a comment