mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-29 17:39:48 +03:00
fixes minor example error in docs
This commit is contained in:
parent
4ca19d6ec3
commit
3bd1348529
|
@ -398,7 +398,7 @@ The JSON representation of a `Tag` object with `name='django'` and its generic f
|
||||||
'tagged_object': {
|
'tagged_object': {
|
||||||
'url': 'https://www.djangoproject.com/'
|
'url': 'https://www.djangoproject.com/'
|
||||||
},
|
},
|
||||||
'tag': 'django'
|
'tag_name': 'django'
|
||||||
}
|
}
|
||||||
|
|
||||||
If you want to have your generic foreign key represented as hyperlink, simply use `HyperlinkedRelatedField` objects:
|
If you want to have your generic foreign key represented as hyperlink, simply use `HyperlinkedRelatedField` objects:
|
||||||
|
@ -421,7 +421,7 @@ The JSON representation of the same `Tag` example object could now look somethin
|
||||||
|
|
||||||
{
|
{
|
||||||
'tagged_object': '/bookmark/1/',
|
'tagged_object': '/bookmark/1/',
|
||||||
'tag': 'django'
|
'tag_name': 'django'
|
||||||
}
|
}
|
||||||
|
|
||||||
These examples cover the default behavior of generic foreign key representation. However, you may also want to write to generic foreign key fields through your API.
|
These examples cover the default behavior of generic foreign key representation. However, you may also want to write to generic foreign key fields through your API.
|
||||||
|
@ -447,7 +447,7 @@ This `Tag` serializer is able to write to it's generic foreign key field:
|
||||||
The following operations would create a `Tag` object with it's `tagged_object` property pointing at the `Bookmark` object found at the given detail end point.
|
The following operations would create a `Tag` object with it's `tagged_object` property pointing at the `Bookmark` object found at the given detail end point.
|
||||||
|
|
||||||
tag_serializer = TagSerializer(data={
|
tag_serializer = TagSerializer(data={
|
||||||
'tag': 'python'
|
'tag_name': 'python'
|
||||||
'tagged_object': '/bookmark/1/'
|
'tagged_object': '/bookmark/1/'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user