aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/relations.md
diff options
context:
space:
mode:
authorTom Christie2013-12-23 14:29:22 +0000
committerTom Christie2013-12-23 14:29:22 +0000
commitd24ea39a4e4131486d45492339dcbbfefb6a933b (patch)
tree22898b181713a73231fa218aa1843bb9925d7801 /docs/api-guide/relations.md
parent333814e29c1366eca42b4e149b5087b3ce2e4164 (diff)
downloaddjango-rest-framework-d24ea39a4e4131486d45492339dcbbfefb6a933b.tar.bz2
Added note on view_name in hyperlinked relationships. Closes #1221
Diffstat (limited to 'docs/api-guide/relations.md')
-rw-r--r--docs/api-guide/relations.md5
1 files changed, 3 insertions, 2 deletions
diff --git a/docs/api-guide/relations.md b/docs/api-guide/relations.md
index 1b089c54..4bee75af 100644
--- a/docs/api-guide/relations.md
+++ b/docs/api-guide/relations.md
@@ -134,7 +134,7 @@ By default this field is read-write, although you can change this behavior using
**Arguments**:
-* `view_name` - The view name that should be used as the target of the relationship. **required**.
+* `view_name` - The view name that should be used as the target of the relationship. If you're using [the standard router classes][routers] this wil be a string with the format `<modelname>-detail`. **required**.
* `many` - If applied to a to-many relationship, you should set this argument to `True`.
* `required` - If set to `False`, the field will accept values of `None` or the empty-string for nullable relationships.
* `queryset` - By default `ModelSerializer` classes will use the default queryset for the relationship. `Serializer` classes must either set a queryset explicitly, or set `read_only=True`.
@@ -202,7 +202,7 @@ This field is always read-only.
**Arguments**:
-* `view_name` - The view name that should be used as the target of the relationship. **required**.
+* `view_name` - The view name that should be used as the target of the relationship. If you're using [the standard router classes][routers] this wil be a string with the format `<model_name>-detail`. **required**.
* `lookup_field` - The field on the target that should be used for the lookup. Should correspond to a URL keyword argument on the referenced view. Default is `'pk'`.
* `format` - If using format suffixes, hyperlinked fields will use the same format suffix for the target unless overridden by using the `format` argument.
@@ -454,6 +454,7 @@ The [drf-nested-routers package][drf-nested-routers] provides routers and relati
[cite]: http://lwn.net/Articles/193245/
[reverse-relationships]: https://docs.djangoproject.com/en/dev/topics/db/queries/#following-relationships-backward
+[routers]: http://django-rest-framework.org/api-guide/routers#defaultrouter
[generic-relations]: https://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1
[2.2-announcement]: ../topics/2.2-announcement.md
[drf-nested-routers]: https://github.com/alanjds/drf-nested-routers