We propose a model for $D^+ to pi^+ pi^- pi^+$ decays following experimental results which indicate that the two-pion interaction in the $S$-wave is dominated by the scalar resonances $f_0(600)/sigma$ and $f_0(980)$. The weak decay amplitude for $D^+to R pi^+$, where $R$ is a resonance that subsequently decays into $pi^+pi^-$, is constructed in a factorization approach. In the $S$-wave, we implement the strong decay $Rto pi^-pi^+$ by means of a scalar form factor. This provides a unitary description of the pion-pion interaction in the entire kinematically allowed mass range $m_{pipi}^2$ from threshold to about 3 GeV$^2$. In order to reproduce the experimental Dalitz plot for $Dppp$, we include contributions beyond the $S$-wave. For the $P$-wave, dominated by the $rho(770)^0$, we use a Breit-Wigner description. Higher waves are accounted for by using the usual isobar prescription for the $f_2(1270)$ and $rho(1450)^0$. The major achievement is a good reproduction of the experimental $m_{pipi}^2$ distribution, and of the partial as well as the total $Dppp$ branching ratios. Our values are generally smaller than the experimental ones. We discuss this shortcoming and, as a byproduct, we predict a value for the poorly known $Dto sigma$ transition form factor at $q^2=m_pi^2$.