More work supporting PerForeignKey templates. Used template-packaging templates, injected into queryj-templates, copied and fixed the generated code back to template packaging. refs #474