From 97be8fb72062036f463ebcd43fa03885fffa965c Mon Sep 17 00:00:00 2001 From: tom-leys Date: Thu, 20 Feb 2014 08:16:36 +1300 Subject: [PATCH] Update relations.md (clarified view_name) It wasn't clear how view_name was derived from the model name in the documentation. It's now broken out into its own section. --- docs/api-guide/relations.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/api-guide/relations.md b/docs/api-guide/relations.md index cc4f55851..e9158a85c 100644 --- a/docs/api-guide/relations.md +++ b/docs/api-guide/relations.md @@ -132,6 +132,17 @@ Would serialize to a representation like this: By default this field is read-write, although you can change this behavior using the `read_only` flag. +**View Name**: + +The view name of your target must be specified using the `view_name` argument. The standard naming is `-detail`. + + +`` : Corresponds to the name of the model, forced to lowercase. In this example `Track` becomes `track` + +`-detail` : Relates to either the detail view `-detail` or the list view `-list` of the related model. + +Note however: When you define a Serialiser, you can customise the `view_name` argument by specifing a custom one in the `Meta:` section of the serialiser definition. + **Arguments**: * `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 `-detail`. **required**.