diff options
| author | Tom Christie | 2013-08-21 19:46:09 +0100 |
|---|---|---|
| committer | Tom Christie | 2013-08-21 19:46:09 +0100 |
| commit | 5e40e50f2b187fe2ff2e8ee63b4e39ece42f1521 (patch) | |
| tree | fff155cd7be62d61204806ac4bde14eeec8691da /docs/api-guide/relations.md | |
| parent | f84d4951bfcc8887d57ca5fa0321cfdbb18a9b6d (diff) | |
| download | django-rest-framework-5e40e50f2b187fe2ff2e8ee63b4e39ece42f1521.tar.bz2 | |
Include import paths throughout docs.
Closes #1051. Thanks to @pydanny for the report.
Diffstat (limited to 'docs/api-guide/relations.md')
| -rw-r--r-- | docs/api-guide/relations.md | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/docs/api-guide/relations.md b/docs/api-guide/relations.md index 829a3c54..aa14bc72 100644 --- a/docs/api-guide/relations.md +++ b/docs/api-guide/relations.md @@ -76,7 +76,7 @@ This field is read only. For example, the following serializer: class AlbumSerializer(serializers.ModelSerializer): - tracks = PrimaryKeyRelatedField(many=True, read_only=True) + tracks = serializers.PrimaryKeyRelatedField(many=True, read_only=True) class Meta: model = Album @@ -110,8 +110,8 @@ By default this field is read-write, although you can change this behavior using For example, the following serializer: class AlbumSerializer(serializers.ModelSerializer): - tracks = HyperlinkedRelatedField(many=True, read_only=True, - view_name='track-detail') + tracks = serializers.HyperlinkedRelatedField(many=True, read_only=True, + view_name='track-detail') class Meta: model = Album @@ -148,7 +148,8 @@ By default this field is read-write, although you can change this behavior using For example, the following serializer: class AlbumSerializer(serializers.ModelSerializer): - tracks = SlugRelatedField(many=True, read_only=True, slug_field='title') + tracks = serializers.SlugRelatedField(many=True, read_only=True, + slug_field='title') class Meta: model = Album @@ -183,7 +184,7 @@ When using `SlugRelatedField` as a read-write field, you will normally want to e This field can be applied as an identity relationship, such as the `'url'` field on a HyperlinkedModelSerializer. It can also be used for an attribute on the object. For example, the following serializer: class AlbumSerializer(serializers.HyperlinkedModelSerializer): - track_listing = HyperlinkedIdentityField(view_name='track-list') + track_listing = serializers.HyperlinkedIdentityField(view_name='track-list') class Meta: model = Album |
