The π-junction transition of a T-shaped double quantum dot system is investigated theoretically by using the nonequilibrium Green’s function method. It is found that the π-junction transition can occur with increasing the spin-flip strength. Furthermore, the π-junction in the system can be controlled by tuning the system parameters, such as the two quantum dot energy levels and the interdot coupling. These controlled π-junction transitions are interpreted in the picture of current-carrying density of states. When the main contributions to supercurrent is changed between the positive discrete spectrum and the negative continuous spectrum, the π-junction transitions can happen.