add serializer_class attribute to UserDetails view

This commit is contained in:
Mateusz Sikora 2014-07-09 16:43:03 +02:00
parent 445c211ebe
commit ee1aedbe23
2 changed files with 8 additions and 3 deletions

View File

@ -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):

View File

@ -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()