aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/relations.md
diff options
context:
space:
mode:
authorTom Christie2013-02-19 17:16:48 +0000
committerTom Christie2013-02-19 17:16:48 +0000
commitc5cf51cf511c84ab3e446376ff38170dcd421958 (patch)
tree755151e5f3740ceb04ba4343fce01bc58eec3c7a /docs/api-guide/relations.md
parent66a6ffaf957405691d0714fc422b46a6927639a7 (diff)
downloaddjango-rest-framework-c5cf51cf511c84ab3e446376ff38170dcd421958.tar.bz2
Fix typos.
Diffstat (limited to 'docs/api-guide/relations.md')
-rw-r--r--docs/api-guide/relations.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/api-guide/relations.md b/docs/api-guide/relations.md
index 5a9d74b0..623fe1a9 100644
--- a/docs/api-guide/relations.md
+++ b/docs/api-guide/relations.md
@@ -302,7 +302,7 @@ Note that reverse relationships are not automatically generated by the `ModelSer
Instead, you must explicitly add it to the serializer. For example:
class AlbumSerializer(serializers.ModelSerializer):
- tracks = serializers.PrimaryKeyRelationship(many=True)
+ tracks = serializers.PrimaryKeyRelatedField(many=True)
...
By default, the field will uses the same accessor as it's field name to retrieve the relationship, so in this example, `Album` instances would need to have the `tracks` attribute for this relationship to work.
@@ -316,7 +316,7 @@ The best way to ensure this is typically to make sure that the relationship on t
Alternatively, you can use the `source` argument on the serializer field, to use a different accessor attribute than the field name. For example.
class AlbumSerializer(serializers.ModelSerializer):
- tracks = serializers.PrimaryKeyRelationship(many=True, source='track_set')
+ tracks = serializers.PrimaryKeyRelatedField(many=True, source='track_set')
See the Django documentation on [reverse relationships][reverse-relationships] for more details.