diff --git a/app/access/serializers/organization.py b/app/access/serializers/organization.py index 6884617f9..80b2bae98 100644 --- a/app/access/serializers/organization.py +++ b/app/access/serializers/organization.py @@ -4,6 +4,8 @@ from access.models import Organization +from api.serializers import common + from app.serializers.user import UserBaseSerializer @@ -40,7 +42,10 @@ class Meta: -class OrganizationModelSerializer(OrganizationBaseSerializer): +class OrganizationModelSerializer( + common.CommonModelSerializer, + OrganizationBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/access/serializers/team_user.py b/app/access/serializers/team_user.py index 82e797e7f..ccd2968fd 100644 --- a/app/access/serializers/team_user.py +++ b/app/access/serializers/team_user.py @@ -3,6 +3,9 @@ from rest_framework import serializers from access.models import TeamUsers + +from api.serializers import common + from app.serializers.user import UserBaseSerializer @@ -49,7 +52,10 @@ class Meta: -class TeamUserModelSerializer(TeamUserBaseSerializer): +class TeamUserModelSerializer( + common.CommonModelSerializer, + TeamUserBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/access/serializers/teams.py b/app/access/serializers/teams.py index e2c9743f6..a1856d287 100644 --- a/app/access/serializers/teams.py +++ b/app/access/serializers/teams.py @@ -3,6 +3,9 @@ from rest_framework import serializers from access.models import Team + +from api.serializers import common + from access.serializers.organization import OrganizationBaseSerializer from app.serializers.permission import PermissionBaseSerializer @@ -52,7 +55,10 @@ class Meta: -class TeamModelSerializer(TeamBaseSerializer): +class TeamModelSerializer( + common.CommonModelSerializer, + TeamBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/api/serializers/common.py b/app/api/serializers/common.py new file mode 100644 index 000000000..313072a9c --- /dev/null +++ b/app/api/serializers/common.py @@ -0,0 +1,9 @@ +from rest_framework import serializers + +from core import fields as centurion_field + + + +class CommonModelSerializer(CommonBaseSerializer): + + model_notes = centurion_field.MarkdownField( required = False ) \ No newline at end of file diff --git a/app/assistance/serializers/knowledge_base.py b/app/assistance/serializers/knowledge_base.py index 7da60b719..e68394b90 100644 --- a/app/assistance/serializers/knowledge_base.py +++ b/app/assistance/serializers/knowledge_base.py @@ -8,6 +8,8 @@ from app.serializers.user import UserBaseSerializer +from api.serializers import common + from assistance.models.knowledge_base import KnowledgeBase from assistance.serializers.knowledge_base_category import KnowledgeBaseCategoryBaseSerializer @@ -54,7 +56,10 @@ class Meta: -class KnowledgeBaseModelSerializer(KnowledgeBaseBaseSerializer): +class KnowledgeBaseModelSerializer( + common.CommonModelSerializer, + KnowledgeBaseBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/assistance/serializers/knowledge_base_category.py b/app/assistance/serializers/knowledge_base_category.py index 9193c7216..bd5098923 100644 --- a/app/assistance/serializers/knowledge_base_category.py +++ b/app/assistance/serializers/knowledge_base_category.py @@ -9,6 +9,8 @@ from app.serializers.user import UserBaseSerializer +from api.serializers import common + from assistance.models.knowledge_base import KnowledgeBaseCategory @@ -55,7 +57,10 @@ class Meta: -class KnowledgeBaseCategoryModelSerializer(KnowledgeBaseCategoryBaseSerializer): +class KnowledgeBaseCategoryModelSerializer( + common.CommonModelSerializer, + KnowledgeBaseCategoryBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/config_management/serializers/config_group.py b/app/config_management/serializers/config_group.py index 9e02cba5b..f06cf2791 100644 --- a/app/config_management/serializers/config_group.py +++ b/app/config_management/serializers/config_group.py @@ -4,6 +4,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from config_management.models.groups import ConfigGroups from itam.serializers.device import DeviceBaseSerializer @@ -52,7 +54,10 @@ class Meta: -class ConfigGroupModelSerializer(ConfigGroupBaseSerializer): +class ConfigGroupModelSerializer( + common.CommonModelSerializer, + ConfigGroupBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/config_management/serializers/config_group_software.py b/app/config_management/serializers/config_group_software.py index bb4937726..454f30a10 100644 --- a/app/config_management/serializers/config_group_software.py +++ b/app/config_management/serializers/config_group_software.py @@ -4,6 +4,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from config_management.models.groups import ConfigGroupSoftware from config_management.serializers.config_group import ConfigGroups, ConfigGroupBaseSerializer @@ -55,7 +57,10 @@ class Meta: -class ConfigGroupSoftwareModelSerializer(ConfigGroupSoftwareBaseSerializer): +class ConfigGroupSoftwareModelSerializer( + common.CommonModelSerializer, + ConfigGroupSoftwareBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/core/serializers/manufacturer.py b/app/core/serializers/manufacturer.py index 5cfdc1eb9..a733576ea 100644 --- a/app/core/serializers/manufacturer.py +++ b/app/core/serializers/manufacturer.py @@ -5,6 +5,8 @@ from app.serializers.user import UserBaseSerializer +from api.serializers import common + from core.models.manufacturer import Manufacturer @@ -39,7 +41,10 @@ class Meta: ] -class ManufacturerModelSerializer(ManufacturerBaseSerializer): +class ManufacturerModelSerializer( + common.CommonModelSerializer, + ManufacturerBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/core/serializers/ticket_category.py b/app/core/serializers/ticket_category.py index ea8b7d940..735ad5452 100644 --- a/app/core/serializers/ticket_category.py +++ b/app/core/serializers/ticket_category.py @@ -3,6 +3,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from core.models.ticket.ticket_category import TicketCategory @@ -39,7 +41,10 @@ class Meta: ] -class TicketCategoryModelSerializer(TicketCategoryBaseSerializer): +class TicketCategoryModelSerializer( + common.CommonModelSerializer, + TicketCategoryBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/core/serializers/ticket_comment_category.py b/app/core/serializers/ticket_comment_category.py index b1924c15c..4441f4463 100644 --- a/app/core/serializers/ticket_comment_category.py +++ b/app/core/serializers/ticket_comment_category.py @@ -5,6 +5,8 @@ from app.serializers.user import UserBaseSerializer +from api.serializers import common + from core.models.ticket.ticket_comment_category import TicketCommentCategory @@ -39,7 +41,10 @@ class Meta: ] -class TicketCommentCategoryModelSerializer(TicketCommentCategoryBaseSerializer): +class TicketCommentCategoryModelSerializer( + common.CommonModelSerializer, + TicketCommentCategoryBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/itam/serializers/device.py b/app/itam/serializers/device.py index 3bfa08211..cc6959dca 100644 --- a/app/itam/serializers/device.py +++ b/app/itam/serializers/device.py @@ -7,6 +7,7 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common from api.viewsets.common import ModelViewSet from core.fields.icon import Icon, IconField @@ -48,7 +49,10 @@ class Meta: 'url', ] -class DeviceModelSerializer(DeviceBaseSerializer): +class DeviceModelSerializer( + common.CommonModelSerializer, + DeviceBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/itam/serializers/device_model.py b/app/itam/serializers/device_model.py index a4cb649e6..6f8b76d09 100644 --- a/app/itam/serializers/device_model.py +++ b/app/itam/serializers/device_model.py @@ -4,6 +4,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from core.serializers.manufacturer import ManufacturerBaseSerializer from itam.models.device_models import DeviceModel @@ -42,7 +44,10 @@ class Meta: ] -class DeviceModelModelSerializer(DeviceModelBaseSerializer): +class DeviceModelModelSerializer( + common.CommonModelSerializer, + DeviceModelBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/itam/serializers/device_software.py b/app/itam/serializers/device_software.py index ebcaeeb4d..857581ad6 100644 --- a/app/itam/serializers/device_software.py +++ b/app/itam/serializers/device_software.py @@ -2,10 +2,10 @@ from rest_framework.fields import empty from rest_framework.reverse import reverse - - from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from core.fields.badge import Badge, BadgeField from itam.models.device import Device, DeviceSoftware @@ -49,7 +49,10 @@ class Meta: ] -class DeviceSoftwareModelSerializer(DeviceSoftwareBaseSerializer): +class DeviceSoftwareModelSerializer( + common.CommonModelSerializer, + DeviceSoftwareBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/itam/serializers/device_type.py b/app/itam/serializers/device_type.py index abb02bdb5..76b590998 100644 --- a/app/itam/serializers/device_type.py +++ b/app/itam/serializers/device_type.py @@ -3,6 +3,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from itam.models.device import DeviceType @@ -38,7 +40,10 @@ class Meta: ] -class DeviceTypeModelSerializer(DeviceTypeBaseSerializer): +class DeviceTypeModelSerializer( + common.CommonModelSerializer, + DeviceTypeBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/itam/serializers/operating_system.py b/app/itam/serializers/operating_system.py index 1b3b3fe89..f0a15db6a 100644 --- a/app/itam/serializers/operating_system.py +++ b/app/itam/serializers/operating_system.py @@ -4,6 +4,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from core.serializers.manufacturer import ManufacturerBaseSerializer from itam.models.operating_system import OperatingSystem @@ -42,7 +44,10 @@ class Meta: ] -class OperatingSystemModelSerializer(OperatingSystemBaseSerializer): +class OperatingSystemModelSerializer( + common.CommonModelSerializer, + OperatingSystemBaseSerializer +): diff --git a/app/itam/serializers/operating_system_version.py b/app/itam/serializers/operating_system_version.py index 62adb469e..1de86a455 100644 --- a/app/itam/serializers/operating_system_version.py +++ b/app/itam/serializers/operating_system_version.py @@ -4,6 +4,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from core.serializers.manufacturer import ManufacturerBaseSerializer from itam.models.operating_system import OperatingSystem, OperatingSystemVersion @@ -54,7 +56,10 @@ class Meta: ] -class OperatingSystemVersionModelSerializer(OperatingSystemVersionBaseSerializer): +class OperatingSystemVersionModelSerializer( + common.CommonModelSerializer, + OperatingSystemVersionBaseSerializer +): diff --git a/app/itam/serializers/software.py b/app/itam/serializers/software.py index f409d9c32..a6be3927c 100644 --- a/app/itam/serializers/software.py +++ b/app/itam/serializers/software.py @@ -3,6 +3,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from core.serializers.manufacturer import ManufacturerBaseSerializer from itam.models.software import Software @@ -41,7 +43,10 @@ class Meta: ] -class SoftwareModelSerializer(SoftwareBaseSerializer): +class SoftwareModelSerializer( + common.CommonModelSerializer, + SoftwareBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/itam/serializers/software_category.py b/app/itam/serializers/software_category.py index b33c52654..9bcb4bd63 100644 --- a/app/itam/serializers/software_category.py +++ b/app/itam/serializers/software_category.py @@ -3,6 +3,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from core.serializers.manufacturer import ManufacturerBaseSerializer from itam.models.software import SoftwareCategory @@ -40,7 +42,10 @@ class Meta: ] -class SoftwareCategoryModelSerializer(SoftwareCategoryBaseSerializer): +class SoftwareCategoryModelSerializer( + common.CommonModelSerializer, + SoftwareCategoryBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/itam/serializers/software_version.py b/app/itam/serializers/software_version.py index ca48b57ad..3a5530650 100644 --- a/app/itam/serializers/software_version.py +++ b/app/itam/serializers/software_version.py @@ -3,6 +3,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from itam.models.software import Software, SoftwareVersion from itam.serializers.software import SoftwareBaseSerializer @@ -50,7 +52,10 @@ class Meta: ] -class SoftwareVersionModelSerializer(SoftwareVersionBaseSerializer): +class SoftwareVersionModelSerializer( + common.CommonModelSerializer, + SoftwareVersionBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/itim/serializers/cluster.py b/app/itim/serializers/cluster.py index af63c5078..37b2750d0 100644 --- a/app/itim/serializers/cluster.py +++ b/app/itim/serializers/cluster.py @@ -3,6 +3,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from itam.serializers.device import DeviceBaseSerializer from itim.serializers.cluster_type import ClusterTypeBaseSerializer @@ -41,7 +43,10 @@ class Meta: ] -class ClusterModelSerializer(ClusterBaseSerializer): +class ClusterModelSerializer( + common.CommonModelSerializer, + ClusterBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/itim/serializers/cluster_type.py b/app/itim/serializers/cluster_type.py index f834d1f02..084a42809 100644 --- a/app/itim/serializers/cluster_type.py +++ b/app/itim/serializers/cluster_type.py @@ -3,6 +3,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from itam.serializers.device import DeviceBaseSerializer from itim.models.clusters import ClusterType @@ -40,7 +42,10 @@ class Meta: ] -class ClusterTypeModelSerializer(ClusterTypeBaseSerializer): +class ClusterTypeModelSerializer( + common.CommonModelSerializer, + ClusterTypeBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/itim/serializers/port.py b/app/itim/serializers/port.py index 081c758d4..5a3ed2b5c 100644 --- a/app/itim/serializers/port.py +++ b/app/itim/serializers/port.py @@ -3,6 +3,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from itam.serializers.device import DeviceBaseSerializer from itim.models.services import Port @@ -43,7 +45,10 @@ class Meta: -class PortModelSerializer(PortBaseSerializer): +class PortModelSerializer( + common.CommonModelSerializer, + PortBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/itim/serializers/service.py b/app/itim/serializers/service.py index 7e5bff7ce..4a4b81793 100644 --- a/app/itim/serializers/service.py +++ b/app/itim/serializers/service.py @@ -4,6 +4,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from itim.serializers.cluster import ClusterBaseSerializer from itim.serializers.port import PortBaseSerializer from itim.models.services import Service @@ -43,7 +45,10 @@ class Meta: ] -class ServiceModelSerializer(ServiceBaseSerializer): +class ServiceModelSerializer( + common.CommonModelSerializer, + ServiceBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/project_management/serializers/project_milestone.py b/app/project_management/serializers/project_milestone.py index 560405e38..75cf41747 100644 --- a/app/project_management/serializers/project_milestone.py +++ b/app/project_management/serializers/project_milestone.py @@ -4,6 +4,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from project_management.models.project_milestone import ProjectMilestone from project_management.serializers.project import Project, ProjectBaseSerializer @@ -52,7 +54,10 @@ class Meta: ] -class ProjectMilestoneModelSerializer(ProjectMilestoneBaseSerializer): +class ProjectMilestoneModelSerializer( + common.CommonModelSerializer, + ProjectMilestoneBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/project_management/serializers/project_states.py b/app/project_management/serializers/project_states.py index 6e7ad2e3e..2b2a95086 100644 --- a/app/project_management/serializers/project_states.py +++ b/app/project_management/serializers/project_states.py @@ -4,6 +4,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from assistance.serializers.knowledge_base import KnowledgeBaseBaseSerializer from project_management.models.project_states import ProjectState @@ -43,7 +45,10 @@ class Meta: -class ProjectStateModelSerializer(ProjectStateBaseSerializer): +class ProjectStateModelSerializer( + common.CommonModelSerializer, + ProjectStateBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/project_management/serializers/project_type.py b/app/project_management/serializers/project_type.py index 74ea6dbdc..c5c585003 100644 --- a/app/project_management/serializers/project_type.py +++ b/app/project_management/serializers/project_type.py @@ -4,6 +4,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from assistance.serializers.knowledge_base import KnowledgeBaseBaseSerializer from project_management.models.project_types import ProjectType @@ -42,7 +44,10 @@ class Meta: ] -class ProjectTypeModelSerializer(ProjectTypeBaseSerializer): +class ProjectTypeModelSerializer( + common.CommonModelSerializer, + ProjectTypeBaseSerializer +): _urls = serializers.SerializerMethodField('get_url') diff --git a/app/settings/serializers/external_links.py b/app/settings/serializers/external_links.py index c63d786ab..fd3c27df0 100644 --- a/app/settings/serializers/external_links.py +++ b/app/settings/serializers/external_links.py @@ -4,6 +4,8 @@ from access.serializers.organization import OrganizationBaseSerializer +from api.serializers import common + from settings.models.external_link import ExternalLink @@ -40,7 +42,10 @@ class Meta: -class ExternalLinkModelSerializer(ExternalLinkBaseSerializer): +class ExternalLinkModelSerializer( + common.CommonModelSerializer, + ExternalLinkBaseSerializer +): _urls = serializers.SerializerMethodField('get_url')