'PUT /api/user/v1/preferences/{username}/{preference_key}'

def put(self, request, username, preference_key):

    try:
        set_user_preference(request.user, preference_key, request.data, username=username)
    except UserNotAuthorized:
        return Response(status=status.HTTP_403_FORBIDDEN)
    except UserNotFound:
        return Response(status=status.HTTP_404_NOT_FOUND)
    except PreferenceValidationError as error:
        return Response({'developer_message': error.preference_errors[preference_key]['developer_message'], 'user_message': error.preference_errors[preference_key]['user_message']}, status=status.HTTP_400_BAD_REQUEST)
    except PreferenceUpdateError as error:
        return Response({'developer_message': error.developer_message, 'user_message': error.user_message}, status=status.HTTP_400_BAD_REQUEST)
    return Response(status=status.HTTP_204_NO_CONTENT)
