@@ -330,6 +330,8 @@ To implement a custom relational field, you should override `RelatedField`, and
...
@@ -330,6 +330,8 @@ To implement a custom relational field, you should override `RelatedField`, and
If you want to implement a read-write relational field, you must also implement the `.to_internal_value(self, data)` method.
If you want to implement a read-write relational field, you must also implement the `.to_internal_value(self, data)` method.
To provide a dynamic queryset based on the `context`, you can also override `.get_queryset(self)` instead of specifying `.queryset` on the class or when initializing the field.
## Example
## Example
For example, we could define a relational field to serialize a track to a custom string representation, using its ordering, title, and duration.
For example, we could define a relational field to serialize a track to a custom string representation, using its ordering, title, and duration.