diff options
Diffstat (limited to 'api-guide/authentication.html')
| -rw-r--r-- | api-guide/authentication.html | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/api-guide/authentication.html b/api-guide/authentication.html index bbce2835..9b11fbe5 100644 --- a/api-guide/authentication.html +++ b/api-guide/authentication.html @@ -307,7 +307,9 @@ WSGIPassAuthorization On 'rest_framework.authtoken' ) </code></pre> -<p>Make sure to run <code>manage.py syncdb</code> after changing your settings. The <code>authtoken</code> database tables are managed by south (see <a href="#schema-migrations">Schema migrations</a> below).</p> +<hr /> +<p><strong>Note:</strong> Make sure to run <code>manage.py syncdb</code> after changing your settings. The <code>rest_framework.authtoken</code> app provides both Django (from v1.7) and South database migrations. See <a href="#schema-migrations">Schema migrations</a> below.</p> +<hr /> <p>You'll also need to create tokens for your users.</p> <pre class="prettyprint lang-py"><code>from rest_framework.authtoken.models import Token @@ -362,7 +364,10 @@ for user in User.objects.all(): </code></pre> <p>Note that the default <code>obtain_auth_token</code> view explicitly uses JSON requests and responses, rather than using default renderer and parser classes in your settings. If you need a customized version of the <code>obtain_auth_token</code> view, you can do so by overriding the <code>ObtainAuthToken</code> view class, and using that in your url conf instead.</p> <h4 id="schema-migrations">Schema migrations</h4> -<p>The <code>rest_framework.authtoken</code> app includes a south migration that will create the authtoken table.</p> +<p>The <code>rest_framework.authtoken</code> app includes both Django native migrations (for Django versions >1.7) and South migrations (for Django versions <1.7) that will create the authtoken table.</p> +<hr /> +<p><strong>Note</strong>: From REST Framework v2.4.0 using South with Django <1.7 requires upgrading South v1.0+</p> +<hr /> <p>If you're using a <a href="https://docs.djangoproject.com/en/dev/topics/auth/customizing/#specifying-a-custom-user-model">custom user model</a> you'll need to make sure that any initial migration that creates the user table runs before the authtoken table is created.</p> <p>You can do so by inserting a <code>needed_by</code> attribute in your user migration:</p> <pre class="prettyprint lang-py"><code>class Migration: |
