Let $Q(x,y)$ be a positive definite quadratic form of discriminant $d$. Let $r_Q(n)$ be the number of solutions of $Q(x,y)=n$. It is known that the function $f_Q(\tau)=\sum_{n=0}^{\infty}r_Q(n)q^n$ is a modular form of weight $1$. Let $Q_1,\ldots,Q_{h_d}$ be representatives for nonequivalent classes of forms of discriminant $D$. Then we have the formula
$$\sum_{k=1}^{h_d}r_Q(n)=\sum_{t\mid n}\chi_d(t).$$
I know how to prove this using ideals and $L$-series, or in an  elementary way. Is there a proof that uses the fact that $f_Q(\tau)$ is a modular form? Can you give me a reference?