aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/routers.md
diff options
context:
space:
mode:
authorXavier Ordoquy2014-04-13 00:05:57 +0200
committerXavier Ordoquy2014-04-13 00:05:57 +0200
commitd08536ad9d026fb7126c430f6d9c18f8540aacd6 (patch)
treea8a1d36ce76867e57da23379694ea0609801990b /docs/api-guide/routers.md
parent2911cd64ad67ba193e3d37322ee71692cb482623 (diff)
parent93b9245b8714287a440023451ff7880a2f6e5b32 (diff)
downloaddjango-rest-framework-d08536ad9d026fb7126c430f6d9c18f8540aacd6.tar.bz2
Merge remote-tracking branch 'origin/master' into 2.4.0
Conflicts: .travis.yml docs/api-guide/fields.md docs/api-guide/routers.md docs/topics/release-notes.md rest_framework/authentication.py rest_framework/serializers.py rest_framework/templatetags/rest_framework.py rest_framework/tests/test_authentication.py rest_framework/tests/test_filters.py rest_framework/tests/test_hyperlinkedserializers.py rest_framework/tests/test_serializer.py rest_framework/tests/test_testing.py rest_framework/utils/encoders.py tox.ini
Diffstat (limited to 'docs/api-guide/routers.md')
-rw-r--r--docs/api-guide/routers.md14
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md
index 249e99a4..819cf980 100644
--- a/docs/api-guide/routers.md
+++ b/docs/api-guide/routers.md
@@ -37,7 +37,19 @@ The example above would generate the following URL patterns:
* URL pattern: `^accounts/$` Name: `'account-list'`
* URL pattern: `^accounts/{pk}/$` Name: `'account-detail'`
-### Registering additional routes
+---
+
+**Note**: The `base_name` argument is used to specify the initial part of the view name pattern. In the example above, that's the `user` or `account` part.
+
+Typically you won't *need* to specify the `base-name` argument, but if you have a viewset where you've defined a custom `get_queryset` method, then the viewset may not have any `.model` or `.queryset` attribute set. If you try to register that viewset you'll see an error like this:
+
+ 'base_name' argument not specified, and could not automatically determine the name from the viewset, as it does not have a '.model' or '.queryset' attribute.
+
+This means you'll need to explicitly set the `base_name` argument when registering the viewset, as it could not be automatically determined from the model name.
+
+---
+
+### Extra link and actions
Any methods on the viewset decorated with `@detail_route` or `@list_route` will also be routed.
For example, given a method like this on the `UserViewSet` class: