django-rest-auth/rest_auth/app_settings.py

48 lines
1.4 KiB
Python
Raw Normal View History

2014-10-08 15:19:34 +04:00
from django.conf import settings
from rest_auth.serializers import (
TokenSerializer as DefaultTokenSerializer,
UserDetailsSerializer as DefaultUserDetailsSerializer,
LoginSerializer as DefaultLoginSerializer,
PasswordResetSerializer as DefaultPasswordResetSerializer,
PasswordResetConfirmSerializer as DefaultPasswordResetConfirmSerializer,
PasswordChangeSerializer as DefaultPasswordChangeSerializer)
2016-01-01 00:10:52 +03:00
from .utils import import_callable, default_create_token
2014-10-08 15:19:34 +04:00
2016-01-01 00:10:52 +03:00
create_token = import_callable(
getattr(settings, 'REST_AUTH_TOKEN_CREATOR', default_create_token))
2014-10-08 15:19:34 +04:00
serializers = getattr(settings, 'REST_AUTH_SERIALIZERS', {})
TokenSerializer = import_callable(
serializers.get('TOKEN_SERIALIZER', DefaultTokenSerializer))
UserDetailsSerializer = import_callable(
serializers.get('USER_DETAILS_SERIALIZER', DefaultUserDetailsSerializer)
)
LoginSerializer = import_callable(
serializers.get('LOGIN_SERIALIZER', DefaultLoginSerializer)
)
PasswordResetSerializer = import_callable(
2015-04-28 11:04:20 +03:00
serializers.get(
'PASSWORD_RESET_SERIALIZER',
DefaultPasswordResetSerializer
)
2014-10-08 15:19:34 +04:00
)
PasswordResetConfirmSerializer = import_callable(
2015-04-28 11:04:20 +03:00
serializers.get(
'PASSWORD_RESET_CONFIRM_SERIALIZER',
DefaultPasswordResetConfirmSerializer
)
2014-10-08 15:19:34 +04:00
)
PasswordChangeSerializer = import_callable(
2015-04-28 11:04:20 +03:00
serializers.get(
'PASSWORD_CHANGE_SERIALIZER',
DefaultPasswordChangeSerializer
)
2014-10-08 15:19:34 +04:00
)