refactor(project_management): Rename History models

ref: #765 #759
This commit is contained in:
2025-05-18 03:06:43 +09:30
parent 4b2e55187c
commit 98b392d4a2
22 changed files with 70 additions and 40 deletions

View File

@ -35,10 +35,10 @@ from itim.models.cluster_type_history import ClusterType, ClusterTypeAuditHistor
from itim.models.port_history import Port, PortAuditHistory
from itim.models.service_history import Service, ServiceAuditHistory
from project_management.models.project_history import Project, ProjectHistory
from project_management.models.project_milestone_history import ProjectMilestone, ProjectMilestoneHistory
from project_management.models.project_state_history import ProjectState, ProjectStateHistory
from project_management.models.project_type_history import ProjectType, ProjectTypeHistory
from project_management.models.project_history import Project, ProjectAuditHistory
from project_management.models.project_milestone_history import ProjectMilestone, ProjectMilestoneAuditHistory
from project_management.models.project_state_history import ProjectState, ProjectStateAuditHistory
from project_management.models.project_type_history import ProjectType, ProjectTypeAuditHistory
from settings.models.external_link_history import ExternalLink, ExternalLinkHistory
@ -348,25 +348,25 @@ def model_details(item_pk, item_class) -> dict:
model_class = Project
history_class = ProjectHistory
history_class = ProjectAuditHistory
case 'projectmilestone':
model_class = ProjectMilestone
history_class = ProjectMilestoneHistory
history_class = ProjectMilestoneAuditHistory
case 'projectstate':
model_class = ProjectState
history_class = ProjectStateHistory
history_class = ProjectStateAuditHistory
case 'projecttype':
model_class = ProjectType
history_class = ProjectTypeHistory
history_class = ProjectTypeAuditHistory
case 'service':

View File

@ -0,0 +1,30 @@
# Generated by Django 5.1.9 on 2025-05-17 17:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0026_rename_manufacturerhistory_manufactureraudithistory'),
('project_management', '0006_alter_project_organization_and_more'),
]
operations = [
migrations.RenameModel(
old_name='ProjectHistory',
new_name='ProjectAuditHistory',
),
migrations.RenameModel(
old_name='ProjectMilestoneHistory',
new_name='ProjectMilestoneAuditHistory',
),
migrations.RenameModel(
old_name='ProjectStateHistory',
new_name='ProjectStateAuditHistory',
),
migrations.RenameModel(
old_name='ProjectTypeHistory',
new_name='ProjectTypeAuditHistory',
),
]

View File

@ -6,7 +6,7 @@ from project_management.models.projects import Project
class ProjectHistory(
class ProjectAuditHistory(
ModelHistory
):

View File

@ -163,12 +163,12 @@ class ProjectMilestone(ProjectCommonFieldsName):
def save_history(self, before: dict, after: dict) -> bool:
from project_management.models.project_milestone_history import ProjectMilestoneHistory
from project_management.models.project_milestone_history import ProjectMilestoneAuditHistory
history = super().save_history(
before = before,
after = after,
history_model = ProjectMilestoneHistory,
history_model = ProjectMilestoneAuditHistory,
)

View File

@ -6,7 +6,7 @@ from project_management.models.project_milestone import ProjectMilestone
class ProjectMilestoneHistory(
class ProjectMilestoneAuditHistory(
ModelHistory
):

View File

@ -6,7 +6,7 @@ from project_management.models.project_states import ProjectState
class ProjectStateHistory(
class ProjectStateAuditHistory(
ModelHistory
):

View File

@ -122,12 +122,12 @@ class ProjectState(ProjectStateCommonFields):
def save_history(self, before: dict, after: dict) -> bool:
from project_management.models.project_state_history import ProjectStateHistory
from project_management.models.project_state_history import ProjectStateAuditHistory
history = super().save_history(
before = before,
after = after,
history_model = ProjectStateHistory,
history_model = ProjectStateAuditHistory,
)

View File

@ -6,7 +6,7 @@ from project_management.models.project_types import ProjectType
class ProjectTypeHistory(
class ProjectTypeAuditHistory(
ModelHistory
):

View File

@ -112,12 +112,12 @@ class ProjectType(ProjectTypeCommonFields):
def save_history(self, before: dict, after: dict) -> bool:
from project_management.models.project_type_history import ProjectTypeHistory
from project_management.models.project_type_history import ProjectTypeAuditHistory
history = super().save_history(
before = before,
after = after,
history_model = ProjectTypeHistory,
history_model = ProjectTypeAuditHistory,
)

View File

@ -385,12 +385,12 @@ class Project(ProjectCommonFieldsName):
def save_history(self, before: dict, after: dict) -> bool:
from project_management.models.project_history import ProjectHistory
from project_management.models.project_history import ProjectAuditHistory
history = super().save_history(
before = before,
after = after,
history_model = ProjectHistory,
history_model = ProjectAuditHistory,
)

View File

@ -2,7 +2,7 @@ from django.test import TestCase
from core.tests.abstract.test_functional_history import HistoryEntriesCommon
from project_management.models.project_history import Project, ProjectHistory
from project_management.models.project_history import Project, ProjectAuditHistory
@ -13,7 +13,7 @@ class History(
model = Project
history_model = ProjectHistory
history_model = ProjectAuditHistory
@classmethod

View File

@ -3,7 +3,7 @@ from django.test import TestCase
from core.tests.abstract.test_functional_history import HistoryEntriesCommon
from project_management.models.projects import Project
from project_management.models.project_milestone_history import ProjectMilestone, ProjectMilestoneHistory
from project_management.models.project_milestone_history import ProjectMilestone, ProjectMilestoneAuditHistory
@ -14,7 +14,7 @@ class History(
model = ProjectMilestone
history_model = ProjectMilestoneHistory
history_model = ProjectMilestoneAuditHistory
@classmethod

View File

@ -2,7 +2,7 @@ from django.test import TestCase
from core.tests.abstract.test_functional_history import HistoryEntriesCommon
from project_management.models.project_state_history import ProjectState, ProjectStateHistory
from project_management.models.project_state_history import ProjectState, ProjectStateAuditHistory
@ -13,7 +13,7 @@ class History(
model = ProjectState
history_model = ProjectStateHistory
history_model = ProjectStateAuditHistory
@classmethod

View File

@ -2,7 +2,7 @@ from django.test import TestCase
from core.tests.abstract.test_functional_history import HistoryEntriesCommon
from project_management.models.project_type_history import ProjectType, ProjectTypeHistory
from project_management.models.project_type_history import ProjectType, ProjectTypeAuditHistory
@ -13,7 +13,7 @@ class History(
model = ProjectType
history_model = ProjectTypeHistory
history_model = ProjectTypeAuditHistory
@classmethod

View File

@ -1,7 +1,7 @@
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from project_management.models.project_history import Project, ProjectHistory
from project_management.models.project_history import Project, ProjectAuditHistory
from core.tests.abstract.test_unit_model_history_api_v2 import PrimaryModelHistoryAPI
@ -13,7 +13,7 @@ class ModelHistoryAPI(
audit_model = Project
model = ProjectHistory
model = ProjectAuditHistory
@classmethod
def setUpTestData(self):

View File

@ -4,7 +4,7 @@ from django.test import TestCase
from core.tests.abstract.test_unit_model_history_api_v2 import PrimaryModelHistoryAPI
from project_management.models.projects import Project
from project_management.models.project_milestone_history import ProjectMilestone, ProjectMilestoneHistory
from project_management.models.project_milestone_history import ProjectMilestone, ProjectMilestoneAuditHistory
@ -17,7 +17,7 @@ class ModelHistoryAPI(
# audit_model_child =
model = ProjectMilestoneHistory
model = ProjectMilestoneAuditHistory
@classmethod
def setUpTestData(self):

View File

@ -1,7 +1,7 @@
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from project_management.models.project_state_history import ProjectState, ProjectStateHistory
from project_management.models.project_state_history import ProjectState, ProjectStateAuditHistory
from core.tests.abstract.test_unit_model_history_api_v2 import PrimaryModelHistoryAPI
@ -13,7 +13,7 @@ class ModelHistoryAPI(
audit_model = ProjectState
model = ProjectStateHistory
model = ProjectStateAuditHistory
@classmethod
def setUpTestData(self):

View File

@ -1,7 +1,7 @@
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from project_management.models.project_type_history import ProjectType, ProjectTypeHistory
from project_management.models.project_type_history import ProjectType, ProjectTypeAuditHistory
from core.tests.abstract.test_unit_model_history_api_v2 import PrimaryModelHistoryAPI
@ -13,7 +13,7 @@ class ModelHistoryAPI(
audit_model = ProjectType
model = ProjectTypeHistory
model = ProjectTypeAuditHistory
@classmethod
def setUpTestData(self):

View File

@ -3,7 +3,7 @@ from drf_spectacular.utils import extend_schema, extend_schema_view, OpenApiResp
from api.viewsets.common import ModelViewSet
# This import only exists so that the migrations can be created
from project_management.models.project_history import ProjectHistory # pylint: disable=W0611:unused-import
from project_management.models.project_history import ProjectAuditHistory # pylint: disable=W0611:unused-import
from project_management.serializers.project import (
Project,
ProjectImportSerializer,

View File

@ -3,7 +3,7 @@ from drf_spectacular.utils import extend_schema, extend_schema_view, OpenApiPara
from api.viewsets.common import ModelViewSet
# This import only exists so that the migrations can be created
from project_management.models.project_milestone_history import ProjectMilestoneHistory # pylint: disable=W0611:unused-import
from project_management.models.project_milestone_history import ProjectMilestoneAuditHistory # pylint: disable=W0611:unused-import
from project_management.serializers.project_milestone import (
ProjectMilestone,
ProjectMilestoneModelSerializer,

View File

@ -3,7 +3,7 @@ from drf_spectacular.utils import extend_schema, extend_schema_view, OpenApiResp
from api.viewsets.common import ModelViewSet
# This import only exists so that the migrations can be created
from project_management.models.project_state_history import ProjectStateHistory # pylint: disable=W0611:unused-import
from project_management.models.project_state_history import ProjectStateAuditHistory # pylint: disable=W0611:unused-import
from project_management.serializers.project_states import (
ProjectState,
ProjectStateModelSerializer,

View File

@ -3,7 +3,7 @@ from drf_spectacular.utils import extend_schema, extend_schema_view, OpenApiResp
from api.viewsets.common import ModelViewSet
# This import only exists so that the migrations can be created
from project_management.models.project_type_history import ProjectTypeHistory # pylint: disable=W0611:unused-import
from project_management.models.project_type_history import ProjectTypeAuditHistory # pylint: disable=W0611:unused-import
from project_management.serializers.project_type import (
ProjectType,
ProjectTypeModelSerializer,