diff options
| author | Xavier Ordoquy | 2014-10-29 22:20:39 +0100 |
|---|---|---|
| committer | Xavier Ordoquy | 2014-10-29 22:20:39 +0100 |
| commit | 4ce4a7c41a3e7b22dfb0aaeeea1c195e7db32447 (patch) | |
| tree | 2ccbf5a0a7cb9d79fcaa7701ccdb09cc4297783d | |
| parent | c164d5b31d68b9462cd071b4fef9614db1b9ba96 (diff) | |
| parent | f25f05dde58908ca6885c88499e4d5984f0f3502 (diff) | |
| download | django-rest-framework-4ce4a7c41a3e7b22dfb0aaeeea1c195e7db32447.tar.bz2 | |
Merge pull request #1997 from agconti/patch-1
docs(api-guide/authentication): updated to reflect new standards in Django 1.7
| -rwxr-xr-x | docs/api-guide/authentication.md | 3 |
1 files changed, 2 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) |
