From ee1aedbe2359d9af5c0f9d3f583914fe19337a9c Mon Sep 17 00:00:00 2001 From: Mateusz Sikora Date: Wed, 9 Jul 2014 16:43:03 +0200 Subject: [PATCH] add serializer_class attribute to UserDetails view --- rest_auth/serializers.py | 6 +++--- rest_auth/views.py | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/rest_auth/serializers.py b/rest_auth/serializers.py index b9a9c92..af4725e 100644 --- a/rest_auth/serializers.py +++ b/rest_auth/serializers.py @@ -75,7 +75,7 @@ class UserUpdateSerializer(DynamicFieldsModelSerializer): -def get_user_registration_profile_serializer(): +def get_user_registration_profile_serializer(*args, **kwargs): if profile_model_path(): class UserRegistrationProfileSerializer(serializers.ModelSerializer): @@ -93,7 +93,7 @@ def get_user_registration_profile_serializer(): return UserRegistrationProfileSerializer -def get_user_profile_serializer(): +def get_user_profile_serializer(*args, **kwargs): if profile_model_path(): class UserProfileSerializer(serializers.ModelSerializer): @@ -115,7 +115,7 @@ def get_user_profile_serializer(): return UserProfileSerializer -def get_user_profile_update_serializer(): +def get_user_profile_update_serializer(*args, **kwargs): if profile_model_path(): class UserProfileUpdateSerializer(serializers.ModelSerializer): diff --git a/rest_auth/views.py b/rest_auth/views.py index 0241d0a..0ed29f7 100644 --- a/rest_auth/views.py +++ b/rest_auth/views.py @@ -185,6 +185,11 @@ class UserDetails(LoggedInRESTAPIView, GenericAPIView): Optional: email, first_name, last_name and UserProfile fields Returns the updated UserProfile and/or User object. """ + if get_user_profile_model(): + serializer_class = get_user_profile_update_serializer() + else: + serializer_class = UserUpdateSerializer + def get_profile_serializer_class(self): return get_user_profile_serializer()