I think you want to show that in each ideal class the number of ideals of norm a is equal to the number of ideals of norm a*/D/. This should follow directly from the following 2 facts.
All primes p dividing /D/ ramify in the ring of integers of Q(root(D)).
The unique ideal of norm /D/ (uniqueness and existence follow from 1, taking a little care about the prime 2) is principal, generated by root (D).
In view of 1. and 2. the map J --> root(D) * J gives the desired bijection.