chore: Remove all references to field is_global

field no longer used

ref: #789 #767
This commit is contained in:
2025-06-06 13:38:59 +09:30
parent 8c406e1d59
commit 8f0d0fbe16
61 changed files with 6 additions and 176 deletions

View File

@ -82,27 +82,6 @@ class TenancyManager(models.Manager):
if len(user_organizations) > 0 and not user.is_superuser:
# if getattr(self.model, 'is_global', False) is True:
# if has_tenant_field:
# return super().get_queryset().select_related('organization').filter(
# models.Q(organization__in=user_organizations)
# # |
# # models.Q(is_global = True)
# )
# else:
# return super().get_queryset().filter(
# models.Q(organization__in=user_organizations)
# # |
# # models.Q(is_global = True)
# )
# else:
if has_tenant_field:
return super().get_queryset().select_related('organization').filter(

View File

@ -66,7 +66,6 @@ class ModelSerializer(
'entity_type',
'display_name',
'model_notes',
'is_global',
'created',
'modified',
'_urls',

View File

@ -41,7 +41,6 @@ class ModelSerializer(
'display_name',
'name',
'model_notes',
'is_global',
'created',
'modified',
'_urls',

View File

@ -46,7 +46,6 @@ class ModelSerializer(
'email',
'directory',
'model_notes',
'is_global',
'created',
'modified',
'_urls',

View File

@ -44,7 +44,6 @@ class ModelSerializer(
'l_name',
'dob',
'model_notes',
'is_global',
'created',
'modified',
'_urls',

View File

@ -94,7 +94,6 @@ class TeamModelSerializer(
'model_notes',
'permissions',
'organization',
'is_global',
'created',
'modified',
'_urls',

View File

@ -17,17 +17,6 @@ class RoleModelTestCases(
kwargs_item_create: dict = None
def test_field_exist_is_global(self):
"""Test model field not used
object must not be settable as a global object
Attribute `is_global` must be defined as None
"""
assert self.model.is_global is None
class RoleModelTest(
RoleModelTestCases,

View File

@ -188,24 +188,6 @@ class TenancyObjectTestCases(
def test_field_exist_is_global(self):
"""Model Field Exists
is_global must exist
"""
assert hasattr(self.model, 'is_global')
# def test_field_type_is_global(self):
# """Model Field Type
# is_global is of type str
# """
# assert type(self.model.is_global) is django_models.BooleanField
def test_field_exist_model_notes(self):
"""Model Field Exists

View File

@ -221,7 +221,6 @@ class ViewSet( SubModelViewSet ):
filterset_fields = [
'organization',
'is_global'
]
model_kwarg = 'entity_model'

View File

@ -29,12 +29,6 @@ class AssetBaseModelTestCases(
parameterized_fields: dict = {
"is_global": {
'field_type': None,
'field_parameter_default_exists': None,
'field_parameter_default_value': None,
'field_parameter_verbose_name_type': None
},
"asset_number": {
'field_type': models.fields.CharField,
'field_parameter_default_exists': False,

View File

@ -416,12 +416,6 @@ class ModelFieldsTestCasesReWrite:
'field_type': fields.TextField,
'field_parameter_verbose_name_type': str
},
"is_global": {
'field_type': fields.BooleanField,
'field_parameter_default_exists': True,
'field_parameter_default_value': False,
'field_parameter_verbose_name_type': str
}
}

View File

@ -101,7 +101,6 @@ class ConfigGroups(
"left": [
'organization',
'name',
'is_global'
],
"right": [
'model_notes',

View File

@ -126,7 +126,6 @@ class ConfigGroupModelSerializer(
'config',
'hosts',
'rendered_config',
'is_global',
'created',
'modified',
'_urls',

View File

@ -90,7 +90,6 @@ class ConfigGroupSoftwareModelSerializer(
'software',
'action',
'version',
'is_global',
'created',
'modified',
'_urls',

View File

@ -62,7 +62,6 @@ class ViewSet( ModelViewSet ):
filterset_fields = [
'organization',
'parent',
'is_global',
]
search_fields = [

View File

@ -62,7 +62,6 @@ class ViewSet( ModelViewSet ):
filterset_fields = [
'organization',
'software',
'is_global',
]

View File

@ -20,7 +20,7 @@ class Command(BaseCommand):
if kwargs['global']:
softwares = Manufacturer.objects.filter(is_global = False)
softwares = Manufacturer.objects.filter()
self.stdout.write('Running global')
@ -45,8 +45,6 @@ class Command(BaseCommand):
softwares = Manufacturer.objects.filter(
~Q(organization = app_settings.global_organization)
|
Q(is_global = False)
&
Q(organization=app_settings.global_organization),
)

View File

@ -45,7 +45,6 @@ class Manufacturer(
"left": [
'organization',
'name',
'is_global',
],
"right": [
'model_notes',

View File

@ -59,7 +59,6 @@ class ManufacturerModelSerializer(
'display_name',
'name',
'model_notes',
'is_global',
'created',
'modified',
'_urls',

View File

@ -60,7 +60,6 @@ class TicketCommentCategoryModelSerializer(
'parent',
'name',
'model_notes',
'is_global',
'created',
'modified',
'_urls',

View File

@ -49,12 +49,6 @@ class TicketBaseModelTestCases(
'field_type': None,
'field_parameter_verbose_name_type': None
},
"is_global": {
'field_type': None,
'field_parameter_default_exists': None,
'field_parameter_default_value': None,
'field_parameter_verbose_name_type': None
},
"external_system": {
'field_type': models.fields.IntegerField,
'field_parameter_default_exists': True,

View File

@ -48,12 +48,6 @@ class TicketCommentBaseModelTestCases(
parameterized_fields: dict = {
"is_global": {
'field_type': None,
'field_parameter_default_exists': None,
'field_parameter_default_value': None,
'field_parameter_verbose_name_type': None
},
"model_notes": {
'field_type': None,
'field_parameter_default_exists': None,

View File

@ -68,7 +68,6 @@ class DeviceType(
"left": [
'organization',
'name',
'is_global',
],
"right": [
'model_notes',
@ -297,7 +296,6 @@ class Device(
"right": [
'model_notes',
'is_virtual',
'is_global',
]
},
{
@ -406,7 +404,6 @@ class Device(
if obj.exists():
obj.update(
is_global = False,
organization = self.organization,
)
@ -690,18 +687,6 @@ class DeviceSoftware(DeviceCommonFields, SaveHistory):
return self.device
def save(
self, force_insert=False, force_update=False, using=None, update_fields=None
):
self.is_global = False
super().save(
force_insert=False, force_update=False, using=None, update_fields=None
)
def save_history(self, before: dict, after: dict) -> bool:
from itam.models.device_software_history import DeviceSoftwareHistory
@ -813,16 +798,6 @@ class DeviceOperatingSystem(DeviceCommonFields, SaveHistory):
return self.device
def save(
self, force_insert=False, force_update=False, using=None, update_fields=None
):
self.is_global = False
super().save(
force_insert=False, force_update=False, using=None, update_fields=None
)
def save_history(self, before: dict, after: dict) -> bool:
from itam.models.device_operating_system_history import DeviceOperatingSystemHistory

View File

@ -58,7 +58,6 @@ class DeviceModel(
'organization',
'manufacturer',
'name',
'is_global',
],
"right": [
'model_notes',

View File

@ -85,7 +85,6 @@ class OperatingSystem(OperatingSystemFieldsName, SaveHistory):
'organization',
'publisher',
'name',
'is_global',
],
"right": [
'model_notes',
@ -242,7 +241,6 @@ class OperatingSystemVersion(OperatingSystemCommonFields, SaveHistory):
],
"right": [
'model_notes',
'is_global',
]
},
]

View File

@ -67,7 +67,6 @@ class SoftwareCategory(SoftwareCommonFields, SaveHistory):
"left": [
'organization',
'name',
'is_global',
],
"right": [
'model_notes',
@ -110,7 +109,6 @@ class SoftwareCategory(SoftwareCommonFields, SaveHistory):
if app_settings.software_categories_is_global:
self.organization = app_settings.global_organization
self.is_global = app_settings.software_categories_is_global
def __str__(self):
@ -192,7 +190,6 @@ class Software(SoftwareCommonFields, SaveHistory):
'publisher',
'name',
'category',
'is_global',
],
"right": [
'model_notes',
@ -287,7 +284,6 @@ class Software(SoftwareCommonFields, SaveHistory):
if app_settings.software_is_global:
self.organization = app_settings.global_organization
self.is_global = app_settings.software_is_global
def get_url( self, request = None ) -> str:
@ -376,7 +372,6 @@ class SoftwareVersion(SoftwareCommonFields, SaveHistory):
"right": [
'model_notes',
'is_virtual',
'is_global',
]
},
]

View File

@ -118,7 +118,6 @@ class DeviceModelSerializer(
'model_notes',
'serial_number',
'uuid',
'is_global',
'is_virtual',
'device_model',
'config',

View File

@ -62,7 +62,6 @@ class DeviceModelModelSerializer(
'manufacturer',
'name',
'model_notes',
'is_global',
'created',
'modified',
'_urls',

View File

@ -58,7 +58,6 @@ class DeviceTypeModelSerializer(
'organization',
'name',
'model_notes',
'is_global',
'created',
'modified',
'_urls',

View File

@ -85,7 +85,6 @@ class OperatingSystemModelSerializer(
'publisher',
'name',
'model_notes',
'is_global',
'created',
'modified',
'_urls',

View File

@ -66,7 +66,6 @@ class OperatingSystemVersionModelSerializer(
'name',
'operating_system',
'model_notes',
'is_global',
'created',
'modified',
'_urls',

View File

@ -105,7 +105,6 @@ class SoftwareModelSerializer(
'name',
'category',
'model_notes',
'is_global',
'created',
'modified',
'_urls',

View File

@ -65,7 +65,6 @@ class SoftwareCategoryModelSerializer(
'display_name',
'name',
'model_notes',
'is_global',
'created',
'modified',
'_urls',

View File

@ -81,7 +81,6 @@ class SoftwareVersionModelSerializer(
'software',
'name',
'model_notes',
'is_global',
'created',
'modified',
'_urls',

View File

@ -156,14 +156,12 @@ def process_inventory(self, data, organization: int):
operating_system = OperatingSystem.objects.filter(
name = data.validated_data['os']['name'],
is_global = True
)
if operating_system.exists():
operating_system = OperatingSystem.objects.get(
name = data.validated_data['os']['name'],
is_global = True
)
@ -198,7 +196,6 @@ def process_inventory(self, data, organization: int):
operating_system = OperatingSystem.objects.create(
name = data.validated_data['os']['name'],
organization = organization,
is_global = True
)
@ -223,7 +220,6 @@ def process_inventory(self, data, organization: int):
operating_system_version = OperatingSystemVersion.objects.create(
organization = organization,
is_global = True,
name = data.validated_data['os']['version_major'],
operating_system = operating_system,
)
@ -314,7 +310,6 @@ def process_inventory(self, data, organization: int):
software_category = SoftwareCategory.objects.create(
organization = software_category_organization,
is_global = True,
name = inventory['category'],
)
@ -336,7 +331,6 @@ def process_inventory(self, data, organization: int):
software = Software.objects.create(
organization = software_organization,
is_global = True,
name = inventory['name'],
category = software_category,
)
@ -368,7 +362,6 @@ def process_inventory(self, data, organization: int):
software_version = SoftwareVersion.objects.create(
organization = organization,
is_global = True,
name = semver,
software = software,
)
@ -389,7 +382,6 @@ def process_inventory(self, data, organization: int):
device_software = DeviceSoftware.objects.create(
organization = organization,
is_global = True,
installedversion = software_version,
software = software,
device = device,

View File

@ -60,7 +60,6 @@ class ViewSet( ModelViewSet ):
""" Device Type """
filterset_fields = [
'is_global',
'organization',
]

View File

@ -60,7 +60,6 @@ class ViewSet( ModelViewSet ):
""" Operating Systems """
filterset_fields = [
'is_global',
'organization',
'publisher',
]

View File

@ -113,7 +113,6 @@ class ViewSet( ModelViewSet ):
""" Operating Systems """
filterset_fields = [
'is_global',
'organization',
]

View File

@ -59,7 +59,6 @@ class ViewSet( ModelViewSet ):
""" Software """
filterset_fields = [
'is_global',
'organization',
]

View File

@ -112,7 +112,6 @@ class ViewSet( ModelViewSet ):
""" Software """
filterset_fields = [
'is_global',
'organization',
'software',
]

View File

@ -72,7 +72,6 @@ class ClusterType(TenancyObject):
"left": [
'organization',
'name',
'is_global',
],
"right": [
'model_notes',
@ -238,7 +237,6 @@ class Cluster(TenancyObject):
'parent_cluster',
'cluster_type',
'name',
'is_global',
],
"right": [
'model_notes',

View File

@ -91,7 +91,6 @@ class Port(TenancyObject):
'organization',
'display_name',
'description',
'is_global',
],
"right": [
'model_notes',

View File

@ -98,7 +98,6 @@ class ClusterModelSerializer(
'rendered_config',
'nodes',
'devices',
'is_global',
'created',
'modified',
'_urls',

View File

@ -58,7 +58,6 @@ class ClusterTypeModelSerializer(
'name',
'model_notes',
'config',
'is_global',
'created',
'modified',
'_urls',

View File

@ -63,7 +63,6 @@ class PortModelSerializer(
'number',
'description',
'protocol',
'is_global',
'created',
'modified',
'_urls',

View File

@ -93,7 +93,6 @@ class ServiceModelSerializer(
'config_key_variable',
'port',
'dependent_service',
'is_global',
'created',
'modified',
'_urls',
@ -115,7 +114,7 @@ class ServiceModelSerializer(
if 'device_id' in self._context['view'].kwargs:
self.Meta.read_only_fields += [ 'cluster', 'device', 'organization', 'is_global' ]
self.Meta.read_only_fields += [ 'cluster', 'device', 'organization', ]
fields = super().get_field_names(declared_fields, info)

View File

@ -60,7 +60,6 @@ class ViewSet( ModelViewSet ):
filterset_fields = [
'organization',
'is_global',
]
search_fields = [

View File

@ -78,7 +78,6 @@ class ProjectMilestone(ProjectCommonFieldsName):
],
"right": [
'description',
'is_global',
]
}
]

View File

@ -78,7 +78,6 @@ class ProjectState(ProjectStateCommonFields):
'organization',
'name',
'runbook',
'is_global',
'is_completed',
],
"right": [

View File

@ -69,7 +69,6 @@ class ProjectType(ProjectTypeCommonFields):
'organization',
'name'
'runbook',
'is_global',
],
"right": [
'model_notes'

View File

@ -103,7 +103,6 @@ class ProjectModelSerializer(
'manager_team',
'team_members',
'is_deleted',
'is_global',
'created',
'modified',
'_urls',

View File

@ -67,7 +67,6 @@ class ProjectMilestoneModelSerializer(
'start_date',
'finish_date',
'project',
'is_global',
'created',
'modified',
'_urls',

View File

@ -63,7 +63,6 @@ class ProjectStateModelSerializer(
'model_notes',
'runbook',
'is_completed',
'is_global',
'created',
'modified',
'_urls',

View File

@ -68,7 +68,6 @@ class ProjectTypeModelSerializer(
'name',
'model_notes',
'runbook',
'is_global',
'created',
'modified',
'_urls',

View File

@ -60,7 +60,6 @@ class ViewSet( ModelViewSet ):
filterset_fields = [
'organization',
'is_global',
]
search_fields = [

View File

@ -60,7 +60,6 @@ class ViewSet( ModelViewSet ):
filterset_fields = [
'organization',
'is_global',
]
search_fields = [

View File

@ -20,7 +20,7 @@ class Command(BaseCommand):
if kwargs['global']:
softwares = DeviceModel.objects.filter(is_global = False)
softwares = DeviceModel.objects.filter()
self.stdout.write('Running global')
@ -45,8 +45,6 @@ class Command(BaseCommand):
softwares = DeviceModel.objects.filter(
~Q(organization = app_settings.global_organization)
|
Q(is_global = False)
&
Q(organization=app_settings.global_organization),
)

View File

@ -20,7 +20,7 @@ class Command(BaseCommand):
if kwargs['global']:
softwares = DeviceType.objects.filter(is_global = False)
softwares = DeviceType.objects.filter()
self.stdout.write('Running global')
@ -45,8 +45,6 @@ class Command(BaseCommand):
softwares = DeviceType.objects.filter(
~Q(organization = app_settings.global_organization)
|
Q(is_global = False)
&
Q(organization=app_settings.global_organization),
)

View File

@ -20,7 +20,7 @@ class Command(BaseCommand):
if kwargs['global']:
softwares = Software.objects.filter(is_global = False)
softwares = Software.objects.filter()
self.stdout.write('Running global')
@ -45,8 +45,6 @@ class Command(BaseCommand):
softwares = Software.objects.filter(
~Q(organization = app_settings.global_organization)
|
Q(is_global = False)
&
Q(organization=app_settings.global_organization),
)

View File

@ -20,7 +20,7 @@ class Command(BaseCommand):
if kwargs['global']:
softwares = SoftwareCategory.objects.filter(is_global = False)
softwares = SoftwareCategory.objects.filter()
self.stdout.write('Running global')
@ -45,8 +45,6 @@ class Command(BaseCommand):
softwares = SoftwareCategory.objects.filter(
~Q(organization = app_settings.global_organization)
|
Q(is_global = False)
&
Q(organization=app_settings.global_organization),
)

View File

@ -109,7 +109,6 @@ class ExternalLink(TenancyObject):
'button_text',
'template',
'colour',
'is_global',
],
"right": [
'model_notes',