Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow dynamic serializer configuration via settings #823

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions djoser/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def __getattribute__(self, item):
"current_user": "djoser.serializers.UserSerializer",
"token": "djoser.serializers.TokenSerializer",
"token_create": "djoser.serializers.TokenCreateSerializer",
"provider_auth": "djoser.social.serializers.ProviderAuthSerializer",
}
),
"EMAIL": ObjDict(
Expand Down Expand Up @@ -122,8 +123,8 @@ def __init__(self, default_settings, explicit_overriden_settings: dict = None):
explicit_overriden_settings = {}

overriden_settings = (
getattr(django_settings, DJOSER_SETTINGS_NAMESPACE, {})
or explicit_overriden_settings
getattr(django_settings, DJOSER_SETTINGS_NAMESPACE, {})
massaroPietro marked this conversation as resolved.
Show resolved Hide resolved
or explicit_overriden_settings
)

self._load_default_settings()
Expand Down
3 changes: 1 addition & 2 deletions djoser/social/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
from social_django.utils import load_backend, load_strategy

from djoser.conf import settings
from djoser.social.serializers import ProviderAuthSerializer


class ProviderAuthView(generics.CreateAPIView):
permission_classes = [permissions.AllowAny]
serializer_class = ProviderAuthSerializer
serializer_class = settings.SERIALIZERS.provider_auth

def get(self, request, *args, **kwargs):
redirect_uri = request.GET.get("redirect_uri")
Expand Down
Loading