'PATCH /api/user/v1/preferences/{username}/'

def patch(self, request, username):

    if ((not request.data) or (not getattr(request.data, 'keys', None))):
        error_message = _('No    data    provided    for    user    preference    update')
        return Response({'developer_message': error_message, 'user_message': error_message}, status=status.HTTP_400_BAD_REQUEST)
    try:
        with transaction.atomic():
            update_user_preferences(request.user, request.data, user=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({'field_errors': error.preference_errors}, 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)
