feat(project_management): save project history

!30 #14
This commit is contained in:
2024-06-18 04:51:53 +09:30
parent a91ae337c4
commit 86fc1448a6
3 changed files with 12 additions and 3 deletions

View File

@ -43,9 +43,12 @@ class View(OrganizationPermission, generic.View):
from settings.models.external_link import ExternalLink
from project_management.models.projects import Project
if not hasattr(self, 'model'):
match self.kwargs['model_name']:
match str(self.kwargs['model_name']).lower():
case 'cluster':
@ -127,6 +130,10 @@ class View(OrganizationPermission, generic.View):
self.model = Service
case 'project':
self.model = Project
case _:
raise Exception('Unable to determine history items model')

View File

@ -1,9 +1,11 @@
from django.db import models
from core.mixin.history_save import SaveHistory
from .project_common import ProjectCommonFieldsName
class Project(ProjectCommonFieldsName):
class Project(ProjectCommonFieldsName, SaveHistory):
class Meta:

View File

@ -103,7 +103,7 @@ section h2 span svg {
{% endif %}
{% if model_name and model_pk %}
{% block content_header_icon %}
<span title="View History" id="content_header_icon" onclick="window.location='{% url '_history' model_name=model_name model_pk=model_pk %}';">
<span title="View History" id="content_header_icon" onclick="window.location='{% url '_history' model_name=model_name model_pk=model_pk as history_url %}{{ history_url|lower}}';">
<svg xmlns="http://www.w3.org/2000/svg" height="30px" viewBox="0 -960 960 960" width="30px">
<path d="M480-120q-138 0-240.5-91.5T122-440h82q14 104 92.5 172T480-200q117 0 198.5-81.5T760-480q0-117-81.5-198.5T480-760q-69 0-129 32t-101 88h110v80H120v-240h80v94q51-64 124.5-99T480-840q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-480q0 75-28.5 140.5t-77 114q-48.5 48.5-114 77T480-120Zm112-192L440-464v-216h80v184l128 128-56 56Z"/>
</svg>