aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Christie2014-10-31 15:19:40 +0000
committerTom Christie2014-10-31 15:19:40 +0000
commit0e59c27e2f64f1ff242d0022d3d143d0aeb549bf (patch)
treec5ed0deaec54b6e99176f51514a84a414bc2ecae
parent159c3de9fc25c63e6e0ca1fe6b0cea26ea38a070 (diff)
parent4ce4a7c41a3e7b22dfb0aaeeea1c195e7db32447 (diff)
downloaddjango-rest-framework-0e59c27e2f64f1ff242d0022d3d143d0aeb549bf.tar.bz2
Merge branch 'master' into version-3.0
-rwxr-xr-xdocs/api-guide/authentication.md3
-rw-r--r--tox.ini2
2 files changed, 4 insertions, 1 deletions
diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md
index b355012e..3a5156fd 100755
--- a/docs/api-guide/authentication.md
+++ b/docs/api-guide/authentication.md
@@ -168,12 +168,13 @@ The `curl` command line tool may be useful for testing token authenticated APIs.
If you want every user to have an automatically generated Token, you can simply catch the User's `post_save` signal.
+ from django.conf import settings
from django.contrib.auth import get_user_model
from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.authtoken.models import Token
- @receiver(post_save, sender=get_user_model())
+ @receiver(post_save, sender=settings.AUTH_USER_MODEL)
def create_auth_token(sender, instance=None, created=False, **kwargs):
if created:
Token.objects.create(user=instance)
diff --git a/tox.ini b/tox.ini
index 5b9a0ffe..d52dd155 100644
--- a/tox.ini
+++ b/tox.ini
@@ -9,6 +9,8 @@ envlist =
[testenv]
commands = ./runtests.py --fast
+setenv =
+ PYTHONDONTWRITEBYTECODE=1
[testenv:flake8]
basepython = python2.7