Fixed 'unneeded:' reporting. I forgot to add the django imports there.

I also added more logging.
I also use the existing db.resolvePkgNames() call in the two places where it was missing before.