Update sourcegroups.py

reduction on the getattr such that foreign keys are supported