[Fixed]-How do I 'cleanly' create this Django/DRF serialization relationship between models?

1👍

This is correct. Suppose I want to request a Hand with ID 1. I would do a GET request for /api/hands/1 right? Do I really expect it to serialize a full user with all the hands of that user? Maybe. It just depends.

To get around it you would define something like:


MinimalUserSerializer
- Returns only email, username, and ID.
- Does not return hands.

And you would use that instead of your full UserSerializer that returns hands all the time.

👤Jeff T

Leave a comment