Lastest docs build

This commit is contained in:
Tom Christie 2013-12-23 14:39:52 +00:00
parent 66cc2d3d5d
commit d4f99dc205
2 changed files with 9 additions and 2 deletions

View File

@ -330,7 +330,7 @@ class Track(models.Model):
<p>By default this field is read-write, although you can change this behavior using the <code>read_only</code> flag.</p>
<p><strong>Arguments</strong>:</p>
<ul>
<li><code>view_name</code> - The view name that should be used as the target of the relationship. <strong>required</strong>.</li>
<li><code>view_name</code> - The view name that should be used as the target of the relationship. If you're using <a href="http://django-rest-framework.org/api-guide/routers#defaultrouter">the standard router classes</a> this wil be a string with the format <code>&lt;modelname&gt;-detail</code>. <strong>required</strong>.</li>
<li><code>many</code> - If applied to a to-many relationship, you should set this argument to <code>True</code>.</li>
<li><code>required</code> - If set to <code>False</code>, the field will accept values of <code>None</code> or the empty-string for nullable relationships.</li>
<li><code>queryset</code> - By default <code>ModelSerializer</code> classes will use the default queryset for the relationship. <code>Serializer</code> classes must either set a queryset explicitly, or set <code>read_only=True</code>.</li>
@ -388,7 +388,7 @@ class Track(models.Model):
<p>This field is always read-only.</p>
<p><strong>Arguments</strong>:</p>
<ul>
<li><code>view_name</code> - The view name that should be used as the target of the relationship. <strong>required</strong>.</li>
<li><code>view_name</code> - The view name that should be used as the target of the relationship. If you're using <a href="http://django-rest-framework.org/api-guide/routers#defaultrouter">the standard router classes</a> this wil be a string with the format <code>&lt;model_name&gt;-detail</code>. <strong>required</strong>.</li>
<li><code>lookup_field</code> - 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 <code>'pk'</code>.</li>
<li><code>format</code> - If using format suffixes, hyperlinked fields will use the same format suffix for the target unless overridden by using the <code>format</code> argument.</li>
</ul>

View File

@ -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>