feat(project_management): Change model to inherit from CenturionModel for Project model

ref: #824 #829 closes #590
This commit is contained in:
2025-06-13 16:01:59 +09:30
parent a9cde74013
commit b378565ff6
4 changed files with 276 additions and 53 deletions

View File

@ -10,7 +10,6 @@ CREATE TABLE IF NOT EXISTS "auth_group" ("id" integer NOT NULL PRIMARY KEY AUTOI
CREATE TABLE IF NOT EXISTS "auth_user" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "password" varchar(128) NOT NULL, "last_login" datetime NULL, "is_superuser" bool NOT NULL, "username" varchar(150) NOT NULL UNIQUE, "last_name" varchar(150) NOT NULL, "email" varchar(254) NOT NULL, "is_staff" bool NOT NULL, "is_active" bool NOT NULL, "date_joined" datetime NOT NULL, "first_name" varchar(150) NOT NULL);
CREATE TABLE IF NOT EXISTS "access_teamusers" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "manager" bool NOT NULL, "created" datetime NOT NULL, "modified" datetime NOT NULL, "team_id" integer NOT NULL REFERENCES "access_team" ("group_ptr_id") DEFERRABLE INITIALLY DEFERRED, "user_id" integer NOT NULL REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "project_management_project_team_members" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "project_id" integer NOT NULL REFERENCES "project_management_project" ("id") DEFERRABLE INITIALLY DEFERRED, "user_id" integer NOT NULL REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "project_management_project" ("is_global" bool NOT NULL, "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "created" datetime NOT NULL, "modified" datetime NOT NULL, "name" varchar(100) NOT NULL UNIQUE, "slug" varchar(50) NOT NULL, "external_ref" integer NULL, "external_system" integer NULL, "description" text NULL, "priority" integer NULL, "code" varchar(25) NULL UNIQUE, "planned_start_date" datetime NULL, "planned_finish_date" datetime NULL, "real_start_date" datetime NULL, "real_finish_date" datetime NULL, "is_deleted" bool NOT NULL, "manager_team_id" integer NULL REFERENCES "access_team" ("group_ptr_id") DEFERRABLE INITIALLY DEFERRED, "manager_user_id" integer NULL REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED, "state_id" integer NULL REFERENCES "project_management_projectstate" ("id") DEFERRABLE INITIALLY DEFERRED, "project_type_id" integer NULL REFERENCES "project_management_projecttype" ("id") DEFERRABLE INITIALLY DEFERRED, "organization_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "project_management_projectmilestone" ("is_global" bool NOT NULL, "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "modified" datetime NOT NULL, "name" varchar(100) NOT NULL UNIQUE, "slug" varchar(50) NOT NULL, "description" text NULL, "start_date" datetime NULL, "finish_date" datetime NULL, "created" datetime NOT NULL, "project_id" integer NOT NULL REFERENCES "project_management_project" ("id") DEFERRABLE INITIALLY DEFERRED, "organization_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "project_management_projectstate" ("is_global" bool NOT NULL, "model_notes" text NULL, "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "created" datetime NOT NULL, "modified" datetime NOT NULL, "name" varchar(50) NOT NULL UNIQUE, "is_completed" bool NOT NULL, "runbook_id" integer NULL REFERENCES "assistance_knowledgebase" ("id") DEFERRABLE INITIALLY DEFERRED, "organization_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "project_management_projecttype" ("is_global" bool NOT NULL, "model_notes" text NULL, "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "created" datetime NOT NULL, "modified" datetime NOT NULL, "name" varchar(50) NOT NULL UNIQUE, "runbook_id" integer NULL REFERENCES "assistance_knowledgebase" ("id") DEFERRABLE INITIALLY DEFERRED, "organization_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED);
@ -105,10 +104,10 @@ CREATE TABLE IF NOT EXISTS "devops_git_group_history" ("modelhistory_ptr_id" int
CREATE TABLE IF NOT EXISTS "devops_github_repository_notes" ("modelnotes_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "core_model_notes" ("id") DEFERRABLE INITIALLY DEFERRED, "model_id" integer NOT NULL REFERENCES "devops_githubrepository" ("gitrepository_ptr_id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "devops_gitlab_repository_notes" ("modelnotes_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "core_model_notes" ("id") DEFERRABLE INITIALLY DEFERRED, "model_id" integer NOT NULL REFERENCES "devops_gitlabrepository" ("gitrepository_ptr_id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "devops_git_group_notes" ("modelnotes_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "core_model_notes" ("id") DEFERRABLE INITIALLY DEFERRED, "model_id" integer NOT NULL REFERENCES "devops_gitgroup" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "access_organization_history" ("modelhistory_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "core_model_history" ("id") DEFERRABLE INITIALLY DEFERRED, "model_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "access_organization_notes" ("modelnotes_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "core_model_notes" ("id") DEFERRABLE INITIALLY DEFERRED, "model_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "settings_appsettings" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "created" datetime NOT NULL, "modified" datetime NOT NULL, "device_model_is_global" bool NOT NULL, "device_type_is_global" bool NOT NULL, "manufacturer_is_global" bool NOT NULL, "software_is_global" bool NOT NULL, "software_categories_is_global" bool NOT NULL, "global_organization_id" integer NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED, "owner_organization_id" integer NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "access_organization_history" ("modelhistory_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "core_model_history" ("id") DEFERRABLE INITIALLY DEFERRED, "model_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "settings_usersettings" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "created" datetime NOT NULL, "modified" datetime NOT NULL, "default_organization_id" integer NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED, "user_id" integer NOT NULL REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED, "timezone" varchar(32) NOT NULL, "browser_mode" integer NOT NULL);
CREATE TABLE IF NOT EXISTS "settings_appsettings" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "created" datetime NOT NULL, "modified" datetime NOT NULL, "device_model_is_global" bool NOT NULL, "device_type_is_global" bool NOT NULL, "manufacturer_is_global" bool NOT NULL, "software_is_global" bool NOT NULL, "software_categories_is_global" bool NOT NULL, "global_organization_id" integer NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED, "owner_organization_id" integer NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "access_company" ("entity_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "access_entity" ("id") DEFERRABLE INITIALLY DEFERRED, "name" varchar(80) NOT NULL);
CREATE TABLE IF NOT EXISTS "access_entity" ("is_global" bool NOT NULL, "model_notes" text NULL, "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "created" datetime NOT NULL, "modified" datetime NOT NULL, "organization_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED, "entity_type" varchar(30) NOT NULL);
CREATE TABLE IF NOT EXISTS "access_person" ("entity_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "access_entity" ("id") DEFERRABLE INITIALLY DEFERRED, "f_name" varchar(64) NOT NULL, "l_name" varchar(64) NOT NULL, "dob" date NULL, "m_name" varchar(100) NULL);
@ -211,6 +210,9 @@ CREATE TABLE IF NOT EXISTS "itim_service_dependent_service" ("id" integer NOT NU
CREATE TABLE IF NOT EXISTS "itim_service" ("model_notes" text NULL, "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "is_template" bool NOT NULL, "name" varchar(50) NOT NULL, "config" text NULL CHECK ((JSON_VALID("config") OR "config" IS NULL)), "config_key_variable" varchar(50) NULL, "created" datetime NOT NULL, "modified" datetime NOT NULL, "cluster_id" integer NULL REFERENCES "itim_cluster" ("id") DEFERRABLE INITIALLY DEFERRED, "device_id" integer NULL REFERENCES "itam_device" ("id") DEFERRABLE INITIALLY DEFERRED, "organization_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED, "template_id" integer NULL REFERENCES "itim_service" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "itim_service_audithistory" ("centurionaudit_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "core_audithistory" ("id") DEFERRABLE INITIALLY DEFERRED, "model_id" integer NOT NULL REFERENCES "itim_service" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "itim_service_centurionmodelnote" ("centurionmodelnote_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "core_centurionmodelnote" ("id") DEFERRABLE INITIALLY DEFERRED, "model_id" integer NOT NULL REFERENCES "itim_service" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "project_management_project" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "created" datetime NOT NULL, "modified" datetime NOT NULL, "name" varchar(100) NOT NULL UNIQUE, "external_ref" integer NULL, "description" text NULL, "priority" integer NULL, "code" varchar(25) NULL UNIQUE, "planned_start_date" datetime NULL, "planned_finish_date" datetime NULL, "real_start_date" datetime NULL, "real_finish_date" datetime NULL, "is_deleted" bool NOT NULL, "manager_team_id" integer NULL REFERENCES "access_team" ("group_ptr_id") DEFERRABLE INITIALLY DEFERRED, "manager_user_id" integer NULL REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED, "organization_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED, "state_id" integer NULL REFERENCES "project_management_projectstate" ("id") DEFERRABLE INITIALLY DEFERRED, "project_type_id" integer NULL REFERENCES "project_management_projecttype" ("id") DEFERRABLE INITIALLY DEFERRED, "external_system" integer NULL);
CREATE TABLE IF NOT EXISTS "project_management_project_audithistory" ("centurionaudit_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "core_audithistory" ("id") DEFERRABLE INITIALLY DEFERRED, "model_id" integer NOT NULL REFERENCES "project_management_project" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "project_management_project_centurionmodelnote" ("centurionmodelnote_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "core_centurionmodelnote" ("id") DEFERRABLE INITIALLY DEFERRED, "model_id" integer NOT NULL REFERENCES "project_management_project" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE TABLE IF NOT EXISTS "django_session" ("session_key" varchar(40) NOT NULL PRIMARY KEY, "session_data" text NOT NULL, "expire_date" datetime NOT NULL);
CREATE TABLE IF NOT EXISTS "social_auth_association" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "server_url" varchar(255) NOT NULL, "handle" varchar(255) NOT NULL, "secret" varchar(255) NOT NULL, "issued" integer NOT NULL, "lifetime" integer NOT NULL, "assoc_type" varchar(64) NOT NULL);
CREATE TABLE IF NOT EXISTS "social_auth_code" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "email" varchar(254) NOT NULL, "code" varchar(32) NOT NULL, "verified" bool NOT NULL, "timestamp" datetime NOT NULL);
@ -218,12 +220,11 @@ CREATE TABLE IF NOT EXISTS "social_auth_nonce" ("id" integer NOT NULL PRIMARY KE
CREATE TABLE IF NOT EXISTS "social_auth_usersocialauth" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "provider" varchar(32) NOT NULL, "uid" varchar(255) NOT NULL, "user_id" integer NOT NULL REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED, "created" datetime NOT NULL, "modified" datetime NOT NULL, "extra_data" text NOT NULL CHECK ((JSON_VALID("extra_data") OR "extra_data" IS NULL)));
CREATE TABLE IF NOT EXISTS "social_auth_partial" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "token" varchar(32) NOT NULL, "next_step" smallint unsigned NOT NULL CHECK ("next_step" >= 0), "backend" varchar(32) NOT NULL, "timestamp" datetime NOT NULL, "data" text NOT NULL CHECK ((JSON_VALID("data") OR "data" IS NULL)));
DELETE FROM sqlite_sequence;
INSERT INTO sqlite_sequence VALUES('django_migrations',210);
INSERT INTO sqlite_sequence VALUES('django_content_type',197);
INSERT INTO sqlite_sequence VALUES('auth_permission',833);
INSERT INTO sqlite_sequence VALUES('django_migrations',211);
INSERT INTO sqlite_sequence VALUES('django_content_type',199);
INSERT INTO sqlite_sequence VALUES('auth_permission',841);
INSERT INTO sqlite_sequence VALUES('auth_group',0);
INSERT INTO sqlite_sequence VALUES('auth_user',0);
INSERT INTO sqlite_sequence VALUES('project_management_project',0);
INSERT INTO sqlite_sequence VALUES('project_management_projectmilestone',0);
INSERT INTO sqlite_sequence VALUES('project_management_projectstate',0);
INSERT INTO sqlite_sequence VALUES('project_management_projecttype',0);
@ -233,8 +234,8 @@ INSERT INTO sqlite_sequence VALUES('core_ticket',0);
INSERT INTO sqlite_sequence VALUES('core_ticketcomment',0);
INSERT INTO sqlite_sequence VALUES('core_ticketlinkeditem',0);
INSERT INTO sqlite_sequence VALUES('settings_externallink',0);
INSERT INTO sqlite_sequence VALUES('settings_appsettings',1);
INSERT INTO sqlite_sequence VALUES('settings_usersettings',0);
INSERT INTO sqlite_sequence VALUES('settings_appsettings',1);
INSERT INTO sqlite_sequence VALUES('access_entity',0);
INSERT INTO sqlite_sequence VALUES('core_ticketbase',0);
INSERT INTO sqlite_sequence VALUES('core_ticketcommentbase',0);
@ -275,6 +276,7 @@ INSERT INTO sqlite_sequence VALUES('itim_clustertype',0);
INSERT INTO sqlite_sequence VALUES('itim_port',0);
INSERT INTO sqlite_sequence VALUES('itim_service_dependent_service',0);
INSERT INTO sqlite_sequence VALUES('itim_service',0);
INSERT INTO sqlite_sequence VALUES('project_management_project',0);
INSERT INTO sqlite_sequence VALUES('social_auth_association',0);
INSERT INTO sqlite_sequence VALUES('social_auth_code',0);
INSERT INTO sqlite_sequence VALUES('social_auth_nonce',0);

View File

@ -0,0 +1,210 @@
# Generated by Django 5.1.9 on 2025-06-13 06:05
import access.models.tenancy_abstract
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("access", "0016_remove_tenant_slug_alter_tenant_manager_and_more"),
("core", "0033_alter_ticketcommentcategory_parent_and_more"),
("project_management", "0006_alter_project_organization_and_more"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.RemoveField(
model_name="project",
name="is_global",
),
migrations.RemoveField(
model_name="project",
name="slug",
),
migrations.AlterField(
model_name="project",
name="description",
field=models.TextField(
blank=True,
help_text="Outline of this Project",
null=True,
verbose_name="Description",
),
),
migrations.AlterField(
model_name="project",
name="external_ref",
field=models.IntegerField(
blank=True,
help_text="External System reference",
null=True,
verbose_name="Reference Number",
),
),
migrations.AlterField(
model_name="project",
name="external_system",
field=models.IntegerField(
blank=True,
choices=[
(1, "Github"),
(2, "Gitlab"),
(9999, "Custom #1 (Imported)"),
(9998, "Custom #2 (Imported)"),
(9997, "Custom #3 (Imported)"),
(9996, "Custom #4 (Imported)"),
(9995, "Custom #5 (Imported)"),
(9994, "Custom #6 (Imported)"),
(9993, "Custom #7 (Imported)"),
(9992, "Custom #8 (Imported)"),
(9991, "Custom #9 (Imported)"),
],
help_text="External system this item derives",
null=True,
verbose_name="External System",
),
),
migrations.AlterField(
model_name="project",
name="id",
field=models.AutoField(
help_text="ID of the item",
primary_key=True,
serialize=False,
unique=True,
verbose_name="ID",
),
),
migrations.AlterField(
model_name="project",
name="manager_team",
field=models.ForeignKey(
blank=True,
help_text="Team which contains the Project Managers",
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="access.team",
verbose_name="Project Manager Team",
),
),
migrations.AlterField(
model_name="project",
name="manager_user",
field=models.ForeignKey(
blank=True,
help_text="User who is the Project Manager",
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="manager_user",
to=settings.AUTH_USER_MODEL,
verbose_name="Manager",
),
),
migrations.AlterField(
model_name="project",
name="organization",
field=models.ForeignKey(
help_text="Tenant this belongs to",
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="access.tenant",
validators=[
access.models.tenancy_abstract.TenancyAbstractModel.validatate_organization_exists
],
verbose_name="Tenant",
),
),
migrations.AlterField(
model_name="project",
name="project_type",
field=models.ForeignKey(
blank=True,
help_text="Type of project",
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="project_management.projecttype",
verbose_name="Project Type",
),
),
migrations.AlterField(
model_name="project",
name="state",
field=models.ForeignKey(
blank=True,
help_text="State of the project",
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="project_management.projectstate",
verbose_name="Project State",
),
),
migrations.CreateModel(
name="ProjectAuditHistory",
fields=[
(
"centurionaudit_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="core.centurionaudit",
),
),
(
"model",
models.ForeignKey(
help_text="Model this history belongs to",
on_delete=django.db.models.deletion.CASCADE,
related_name="audit_history",
to="project_management.project",
verbose_name="Model",
),
),
],
options={
"verbose_name": "Project History",
"verbose_name_plural": "Project Histories",
"db_table": "project_management_project_audithistory",
"managed": True,
},
bases=("core.centurionaudit",),
),
migrations.CreateModel(
name="ProjectCenturionModelNote",
fields=[
(
"centurionmodelnote_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="core.centurionmodelnote",
),
),
(
"model",
models.ForeignKey(
help_text="Model this note belongs to",
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="project_management.project",
verbose_name="Model",
),
),
],
options={
"verbose_name": "Project Note",
"verbose_name_plural": "Project Notes",
"db_table": "project_management_project_centurionmodelnote",
"managed": True,
},
bases=("core.centurionmodelnote",),
),
]

View File

@ -2,7 +2,8 @@ from django.db import models
from access.fields import AutoCreatedField
from .projects import Project, ProjectCommonFieldsName
from .projects import Project
from .project_common import ProjectCommonFieldsName

View File

@ -1,16 +1,21 @@
from django.conf import settings
from django.db import models
from access.fields import AutoLastModifiedField
from access.models.team import Team
from core.models.centurion import CenturionModel
from core.models.ticket.ticket_enum_values import TicketValues
from .project_common import ProjectCommonFieldsName
from .project_states import ProjectState
from .project_types import ProjectType
class Project(ProjectCommonFieldsName):
class Project(
CenturionModel
):
model_tag = 'project'
class Meta:
@ -30,18 +35,29 @@ class Project(ProjectCommonFieldsName):
class Ticket_ExternalSystem(models.IntegerChoices): # <null|github|gitlab>
GITHUB = TicketValues.ExternalSystem._GITHUB_INT, TicketValues.ExternalSystem._GITHUB_VALUE
GITLAB = TicketValues.ExternalSystem._GITLAB_INT, TicketValues.ExternalSystem._GITLAB_VALUE
GITHUB = TicketValues.ExternalSystem._GITHUB_INT, \
TicketValues.ExternalSystem._GITHUB_VALUE
GITLAB = TicketValues.ExternalSystem._GITLAB_INT, \
TicketValues.ExternalSystem._GITLAB_VALUE
CUSTOM_1 = TicketValues.ExternalSystem._CUSTOM_1_INT, TicketValues.ExternalSystem._CUSTOM_1_VALUE
CUSTOM_2 = TicketValues.ExternalSystem._CUSTOM_2_INT, TicketValues.ExternalSystem._CUSTOM_2_VALUE
CUSTOM_3 = TicketValues.ExternalSystem._CUSTOM_3_INT, TicketValues.ExternalSystem._CUSTOM_3_VALUE
CUSTOM_4 = TicketValues.ExternalSystem._CUSTOM_4_INT, TicketValues.ExternalSystem._CUSTOM_4_VALUE
CUSTOM_5 = TicketValues.ExternalSystem._CUSTOM_5_INT, TicketValues.ExternalSystem._CUSTOM_5_VALUE
CUSTOM_6 = TicketValues.ExternalSystem._CUSTOM_6_INT, TicketValues.ExternalSystem._CUSTOM_6_VALUE
CUSTOM_7 = TicketValues.ExternalSystem._CUSTOM_7_INT, TicketValues.ExternalSystem._CUSTOM_7_VALUE
CUSTOM_8 = TicketValues.ExternalSystem._CUSTOM_8_INT, TicketValues.ExternalSystem._CUSTOM_8_VALUE
CUSTOM_9 = TicketValues.ExternalSystem._CUSTOM_9_INT, TicketValues.ExternalSystem._CUSTOM_9_VALUE
CUSTOM_1 = TicketValues.ExternalSystem._CUSTOM_1_INT, \
TicketValues.ExternalSystem._CUSTOM_1_VALUE
CUSTOM_2 = TicketValues.ExternalSystem._CUSTOM_2_INT, \
TicketValues.ExternalSystem._CUSTOM_2_VALUE
CUSTOM_3 = TicketValues.ExternalSystem._CUSTOM_3_INT, \
TicketValues.ExternalSystem._CUSTOM_3_VALUE
CUSTOM_4 = TicketValues.ExternalSystem._CUSTOM_4_INT, \
TicketValues.ExternalSystem._CUSTOM_4_VALUE
CUSTOM_5 = TicketValues.ExternalSystem._CUSTOM_5_INT, \
TicketValues.ExternalSystem._CUSTOM_5_VALUE
CUSTOM_6 = TicketValues.ExternalSystem._CUSTOM_6_INT, \
TicketValues.ExternalSystem._CUSTOM_6_VALUE
CUSTOM_7 = TicketValues.ExternalSystem._CUSTOM_7_INT, \
TicketValues.ExternalSystem._CUSTOM_7_VALUE
CUSTOM_8 = TicketValues.ExternalSystem._CUSTOM_8_INT, \
TicketValues.ExternalSystem._CUSTOM_8_VALUE
CUSTOM_9 = TicketValues.ExternalSystem._CUSTOM_9_INT, \
TicketValues.ExternalSystem._CUSTOM_9_VALUE
@ -60,9 +76,8 @@ class Project(ProjectCommonFieldsName):
external_ref = models.IntegerField(
blank = True,
default=None,
help_text = 'External System reference',
null=True,
null = True,
verbose_name = 'Reference Number',
) # external reference or null. i.e. github issue number
@ -70,24 +85,30 @@ class Project(ProjectCommonFieldsName):
external_system = models.IntegerField(
blank = True,
choices=Ticket_ExternalSystem,
default=None,
help_text = 'External system this item derives',
null=True,
null = True,
verbose_name = 'External System',
)
name = models.CharField(
blank = False,
help_text = 'Name of the item',
max_length = 100,
unique = True,
verbose_name = 'Name'
)
description = models.TextField(
blank = True,
help_text = 'Outline of this Project',
default = None,
null= True,
null = True,
verbose_name = 'Description'
)
priority = models.IntegerField(
blank = False,
choices =Priority,
choices = Priority,
default = Priority.LOW,
help_text = 'Priority of the project',
null = True,
@ -96,21 +117,21 @@ class Project(ProjectCommonFieldsName):
state = models.ForeignKey(
ProjectState,
blank= True,
blank = True,
help_text = 'State of the project',
on_delete=models.SET_NULL,
on_delete = models.PROTECT,
null = True,
verbose_name ='Project State'
verbose_name = 'Project State'
)
project_type = models.ForeignKey(
ProjectType,
blank= True,
blank = True,
help_text = 'Type of project',
on_delete=models.SET_NULL,
on_delete = models.PROTECT,
null = True,
verbose_name ='Project Type'
verbose_name = 'Project Type'
)
code = models.CharField(
@ -152,9 +173,9 @@ class Project(ProjectCommonFieldsName):
manager_user = models.ForeignKey(
settings.AUTH_USER_MODEL,
blank= True,
blank = True,
help_text = 'User who is the Project Manager',
on_delete=models.SET_NULL,
on_delete = models.PROTECT,
null = True,
related_name = 'manager_user',
verbose_name = 'Manager'
@ -162,9 +183,9 @@ class Project(ProjectCommonFieldsName):
manager_team = models.ForeignKey(
Team,
blank= True,
blank = True,
help_text = 'Team which contains the Project Managers',
on_delete=models.SET_NULL,
on_delete = models.PROTECT,
null = True,
verbose_name = 'Project Manager Team'
)
@ -184,6 +205,8 @@ class Project(ProjectCommonFieldsName):
verbose_name = 'Deleted',
)
modified = AutoLastModifiedField()
page_layout: dict = [
{
@ -329,7 +352,7 @@ class Project(ProjectCommonFieldsName):
)
for ticket in tickets:
estimation = ticket.estimate
if ticket.estimate is None:
@ -381,16 +404,3 @@ class Project(ProjectCommonFieldsName):
)
return str(calculation) + '%'
def save_history(self, before: dict, after: dict) -> bool:
from project_management.models.project_history import ProjectHistory
history = super().save_history(
before = before,
after = after,
history_model = ProjectHistory,
)
return history