diff options
| author | Tom Christie | 2013-12-23 14:39:52 +0000 | 
|---|---|---|
| committer | Tom Christie | 2013-12-23 14:39:52 +0000 | 
| commit | d4f99dc2054ff513a7bde6471f4979fb6df4168c (patch) | |
| tree | 78de66c2186e7a9889459bae496802c0c6a1a041 /api-guide/routers.html | |
| parent | 66cc2d3d5d611c57638a59932cd65c62d9b130c2 (diff) | |
| download | django-rest-framework-d4f99dc2054ff513a7bde6471f4979fb6df4168c.tar.bz2 | |
Lastest docs build
Diffstat (limited to 'api-guide/routers.html')
| -rw-r--r-- | api-guide/routers.html | 7 | 
1 files changed, 7 insertions, 0 deletions
diff --git a/api-guide/routers.html b/api-guide/routers.html index 028314bc..365154ad 100644 --- a/api-guide/routers.html +++ b/api-guide/routers.html @@ -243,6 +243,13 @@ urlpatterns = router.urls  <li>URL pattern: <code>^accounts/$</code>  Name: <code>'account-list'</code></li>  <li>URL pattern: <code>^accounts/{pk}/$</code>  Name: <code>'account-detail'</code></li>  </ul> +<hr /> +<p><strong>Note</strong>: The <code>base_name</code> argument is used to specify the initial part of the view name pattern.  In the example above, that's the <code>user</code> or <code>account</code> part.</p> +<p>Typically you won't <em>need</em> to specify the <code>base-name</code> argument, but if you have a viewset where you've defined a custom <code>get_queryset</code> method, then the viewset may not have any <code>.model</code> or <code>.queryset</code> attribute set.  If you try to register that viewset you'll see an error like this:</p> +<pre class="prettyprint lang-py"><code>'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. +</code></pre> +<p>This means you'll need to explicitly set the <code>base_name</code> argument when registering the viewset, as it could not be automatically determined from the model name.</p> +<hr />  <h3 id="extra-link-and-actions">Extra link and actions</h3>  <p>Any methods on the viewset decorated with <code>@link</code> or <code>@action</code> will also be routed.  For example, given a method like this on the <code>UserViewSet</code> class:</p>  | 
