TAMU-CPT / cc-automated-drf-template

BSD 3-Clause "New" or "Revised" License
13 stars 3 forks source link

ForeignKey in Model #7

Open vinyasmusic opened 7 years ago

vinyasmusic commented 7 years ago

Hello

How do you handle foreignkeys and M2M fields while creating the serializers

hexylena commented 7 years ago

Currently we just use the default serializer behaviour (i.e. using the linked object's ID) rather than using the "correct" serializer. It would be non-trivial to implement automatic serialization of linked object and produce much messier code, so we leave it to the user's discretion. This project should get you halfway there doing all of the painful and repetitive tasks, but the fine details of what you want from your API are left as implementation details to the user.