def save_friends(user_id, friend_jarray): for name in friend_jarray: friend = Friend() friend.user_id = user_id friend.friends = name friend.save()