def save_model(self, request, abstract_category, form, change): workgroups = [] if not abstract_category.pk and not request.user.is_superuser: workgroups = request_workgroups(request) abstract_category.save() relation = WORKGROUP_RELATIONS[self.model] for workgroup in workgroups: getattr(workgroup, relation).add(abstract_category)