Given a newform $g$ of weight $2$ and level $\Gamma_{0}(N)$ with CM by $K = \mathbb{Q}(\sqrt{-D})$, we have $N = MD$, where $M$ is the norm of a chosen ideal $\mathfrak{m}$ in $K$, and the Hecke character associated to $g$ takes fractional ideals prime to $\mathfrak{m}$ to non-zero complex numbers.
On, e.g., LMFDB, it seems that the level $N$ of the CM newform is always divisible by $D^{2}$. Is this true in general? I'm not sure how to relate $M$ from above to $D$, or I could be missing some classical fact from algebraic number theory?