[#1038] Improve performance of viewing hierarchy, avoiding groups as SQLAlchemy objects.

Conflicts:
	ckan/tests/models/test_group.py
[#1038] Patch pulled from 1038 branch - this file was missed before.
[#1038] get_parent_groups added

* get_parent_groups is used by DGU and no doubt others that use hierarchy.
* get_children_groups changed to return objects as that is more convenient
  for DGU.