Reply to comment

A Django REST Framework Technique for more Detailed Related Records

This is a nice way to deal with building lists of objects to display in tables. It's kind of hidden in there, but in your serializer, you can specify that a field is represented by another serializer.

The result is a list of objects instead of a list of URLs or PKs.

Now, going with that, you can save on data transfer by serializing only a few fields.

What you do is copy the related object's serializer, and delete fields until you get a limited peek into the object. You might also want to add the URL fields with the HyperlinkedIdentityField class.

Reply

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.

More information about formatting options

1 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.