Skip to content

Commit ffde169

Browse files
authored
Add docs link to to_internal_value() (encode#7476)
1 parent 1ef1928 commit ffde169

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/api-guide/relations.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ output representation should be generated from the model instance.
337337

338338
To implement a custom relational field, you should override `RelatedField`, and implement the `.to_representation(self, value)` method. This method takes the target of the field as the `value` argument, and should return the representation that should be used to serialize the target. The `value` argument will typically be a model instance.
339339

340-
If you want to implement a read-write relational field, you must also implement the `.to_internal_value(self, data)` method.
340+
If you want to implement a read-write relational field, you must also implement the [`.to_internal_value(self, data)` method][to_internal_value].
341341

342342
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.
343343

@@ -605,3 +605,4 @@ The [rest-framework-generic-relations][drf-nested-relations] library provides re
605605
[drf-nested-relations]: https://github.com/Ian-Foote/rest-framework-generic-relations
606606
[django-intermediary-manytomany]: https://docs.djangoproject.com/en/2.2/topics/db/models/#intermediary-manytomany
607607
[dealing-with-nested-objects]: https://www.django-rest-framework.org/api-guide/serializers/#dealing-with-nested-objects
608+
[to_internal_value]: https://www.django-rest-framework.org/api-guide/serializers/#to_internal_valueself-data

0 commit comments

Comments
 (0)