1
1
mirror of https://github.com/Tivix/django-rest-auth.git synced 2025-07-26 15:39:46 +03:00
django-rest-auth/rest_auth/models.py
Daniel Stanton e9c4ecbc07 Use REST_AUTH_TOKEN_APP and remove REST_USE_JWT
Prevent simultaneous Knox and JWT use. Options are 'jwt' or 'knox'
2017-01-24 14:20:41 +00:00

17 lines
536 B
Python

from django.conf import settings
if getattr(settings, 'REST_AUTH_TOKEN_APP', False) is 'knox':
try:
from knox.models import AuthToken as DefaultTokenModel
except ImportError:
raise ImportError("Install django-rest-knox before setting REST_AUTH_TOKEN_APP to 'knox'")
else:
from rest_framework.authtoken.models import Token as DefaultTokenModel
from .utils import import_callable
# Register your models here.
TokenModel = import_callable(
getattr(settings, 'REST_AUTH_TOKEN_MODEL', DefaultTokenModel))