mirror of
				https://github.com/Tivix/django-rest-auth.git
				synced 2025-11-04 09:37:35 +03:00 
			
		
		
		
	add serializer_class attribute to UserDetails view
This commit is contained in:
		
							parent
							
								
									445c211ebe
								
							
						
					
					
						commit
						ee1aedbe23
					
				| 
						 | 
				
			
			@ -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):
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user