def _check_remove_last_super(user_obj):
 if (not user_obj.is_superuser):
  return
 all_active_su = User.objects.filter(is_superuser__exact=True, is_active__exact=True)
 num_active_su = all_active_su.count()
 if (num_active_su < 1):
  raise PopupException(_('No active superuser configured.'))
 if (num_active_su == 1):
  raise PopupException(_('You cannot remove the last active superuser from the configuration.'), error_code=401)

def _check_remove_last_super ( user_obj ) : if ( not user_obj . is_superuser ) : return all_active_su = User . objects . filter ( is_superuser__exact = True , is_active__exact = True ) num_active_su = all_active_su . count ( ) if ( num_active_su < 1 ) : raise PopupException ( _ ( 'No active superuser configured.' ) ) if ( num_active_su == 1 ) : raise PopupException ( _ ( 'You cannot remove the last active superuser from the configuration.' ) , error_code = 401 )
raise an error if were removing the last superuser .