parameters: (sender, instance, **kwargs)
docstring: save_related_job_templates loops through all of the
      job templates that use an Inventory that have had their
      Organization updated. This triggers the rebuilding of the RBAC hierarchy
      and ensures the proper access restrictions.
docstring_summary: save_related_job_templates loops through all of the
      job templates that use an Inventory that have had their
      Organization updated. This triggers the rebuilding of the RBAC hierarchy
      and ensures the proper access restrictions.
docstring_tokens: save_related_job_templates loops through all of the job templates that use an Inventory that have had their Organization updated . This triggers the rebuilding of the RBAC hierarchy and ensures the proper access restrictions .
function: def save_related_job_templates(sender, instance, **kwargs):
      """save_related_job_templates loops through all of the
      job templates that use an Inventory that have had their
      Organization updated. This triggers the rebuilding of the RBAC hierarchy
      and ensures the proper access restrictions.
      """
      if sender is not Inventory:
          raise ValueError('This signal callback is only intended for use with Project or Inventory')
  
      update_fields = kwargs.get('update_fields', None)
      if (update_fields and not ('organization' in update_fields or 'organization_id' in update_fields)) or kwargs.get('created', False):
          return
  
      if instance._prior_values_store.get('organization_id') != instance.organization_id:
          jtq = JobTemplate.objects.filter(**{sender.__name__.lower(): instance})
          for jt in jtq:
              parents_added, parents_removed = update_role_parentage_for_instance(jt)
              if parents_added or parents_removed:
                  logger.info(
                      'Permissions on JT {} changed due to inventory {} organization change from {} to {}.'.format(
                          jt.pk, instance.pk, instance._prior_values_store.get('organization_id'), instance.organization_id
                      )
                  )
function_tokens: def save_related_job_templates ( sender , instance , * * kwargs ) : if sender is not Inventory : raise ValueError ( 'This signal callback is only intended for use with Project or Inventory' ) update_fields = kwargs . get ( 'update_fields' , None ) if ( update_fields and not ( 'organization' in update_fields or 'organization_id' in update_fields ) ) or kwargs . get ( 'created' , False ) : return if instance . _prior_values_store . get ( 'organization_id' ) != instance . organization_id : jtq = JobTemplate . objects . filter ( * * { sender . __name__ . lower ( ) : instance } ) for jt in jtq : parents_added , parents_removed = update_role_parentage_for_instance ( jt ) if parents_added or parents_removed : logger . info ( 'Permissions on JT {} changed due to inventory {} organization change from {} to {}.' . format ( jt . pk , instance . pk , instance . _prior_values_store . get ( 'organization_id' ) , instance . organization_id ) )