feat(project_management): add priority field to project model, form and api endpoint
ref: #293 #299
This commit is contained in:
@ -46,6 +46,7 @@ class ProjectSerializer(
|
||||
'organization',
|
||||
'state',
|
||||
'project_type',
|
||||
'priority',
|
||||
'name',
|
||||
'description',
|
||||
'code',
|
||||
|
@ -323,12 +323,12 @@ class Ticket(
|
||||
|
||||
|
||||
class TicketPriority(models.IntegerChoices):
|
||||
VERY_LOW = '1', 'Very Low'
|
||||
LOW = '2', 'Low'
|
||||
MEDIUM = '3', 'Medium'
|
||||
HIGH = '4', 'High'
|
||||
VERY_HIGH = '5', 'Very High'
|
||||
MAJOR = '6', 'Major'
|
||||
VERY_LOW = TicketValues.Priority._VERY_LOW_INT, TicketValues.Priority._VERY_LOW_VALUE
|
||||
LOW = TicketValues.Priority._LOW_INT, TicketValues.Priority._LOW_VALUE
|
||||
MEDIUM = TicketValues.Priority._MEDIUM_INT, TicketValues.Priority._MEDIUM_VALUE
|
||||
HIGH = TicketValues.Priority._HIGH_INT, TicketValues.Priority._HIGH_VALUE
|
||||
VERY_HIGH = TicketValues.Priority._VERY_HIGH_INT, TicketValues.Priority._VERY_HIGH_VALUE
|
||||
MAJOR = TicketValues.Priority._MAJOR_INT, TicketValues.Priority._MAJOR_VALUE
|
||||
|
||||
|
||||
|
||||
|
@ -106,4 +106,21 @@ class TicketValues:
|
||||
_CUSTOM_8_INT = '9992'
|
||||
_CUSTOM_8_VALUE = 'Custom #8 (Imported)'
|
||||
_CUSTOM_9_INT = '9991'
|
||||
_CUSTOM_9_VALUE = 'Custom #9 (Imported)'
|
||||
_CUSTOM_9_VALUE = 'Custom #9 (Imported)'
|
||||
|
||||
|
||||
|
||||
class Priority:
|
||||
|
||||
_VERY_LOW_INT = '1'
|
||||
_VERY_LOW_VALUE = 'Very Low'
|
||||
_LOW_INT = '2'
|
||||
_LOW_VALUE = 'Low'
|
||||
_MEDIUM_INT = '3'
|
||||
_MEDIUM_VALUE = 'Medium'
|
||||
_HIGH_INT = '4'
|
||||
_HIGH_VALUE = 'High'
|
||||
_VERY_HIGH_INT = '5'
|
||||
_VERY_HIGH_VALUE = 'Very High'
|
||||
_MAJOR_INT = '6'
|
||||
_MAJOR_VALUE = 'Major'
|
||||
|
@ -58,6 +58,7 @@ class DetailForm(ProjectForm):
|
||||
'organization',
|
||||
'code',
|
||||
'name',
|
||||
'priority',
|
||||
'project_type',
|
||||
'state',
|
||||
'completed',
|
||||
|
18
app/project_management/migrations/0007_project_priority.py
Normal file
18
app/project_management/migrations/0007_project_priority.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.8 on 2024-09-17 04:16
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('project_management', '0006_project_project_type_alter_project_state'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='project',
|
||||
name='priority',
|
||||
field=models.IntegerField(choices=[(1, 'Very Low'), (2, 'Low'), (3, 'Medium'), (4, 'High'), (5, 'Very High'), (6, 'Major')], default=2, help_text='Priority of the project', null=True, verbose_name='Priority'),
|
||||
),
|
||||
]
|
@ -41,6 +41,16 @@ class Project(ProjectCommonFieldsName):
|
||||
CUSTOM_9 = TicketValues.ExternalSystem._CUSTOM_9_INT, TicketValues.ExternalSystem._CUSTOM_9_VALUE
|
||||
|
||||
|
||||
|
||||
class Priority(models.IntegerChoices):
|
||||
VERY_LOW = TicketValues.Priority._VERY_LOW_INT, TicketValues.Priority._VERY_LOW_VALUE
|
||||
LOW = TicketValues.Priority._LOW_INT, TicketValues.Priority._LOW_VALUE
|
||||
MEDIUM = TicketValues.Priority._MEDIUM_INT, TicketValues.Priority._MEDIUM_VALUE
|
||||
HIGH = TicketValues.Priority._HIGH_INT, TicketValues.Priority._HIGH_VALUE
|
||||
VERY_HIGH = TicketValues.Priority._VERY_HIGH_INT, TicketValues.Priority._VERY_HIGH_VALUE
|
||||
MAJOR = TicketValues.Priority._MAJOR_INT, TicketValues.Priority._MAJOR_VALUE
|
||||
|
||||
|
||||
# class ProjectStates(enum):
|
||||
# OPEN = 1
|
||||
# CLOSED = 1
|
||||
@ -70,7 +80,14 @@ class Project(ProjectCommonFieldsName):
|
||||
null= True,
|
||||
)
|
||||
|
||||
# priority
|
||||
priority = models.IntegerField(
|
||||
blank = False,
|
||||
choices =Priority,
|
||||
default = Priority.LOW,
|
||||
help_text = 'Priority of the project',
|
||||
null = True,
|
||||
verbose_name ='Priority'
|
||||
)
|
||||
|
||||
state = models.ForeignKey(
|
||||
ProjectState,
|
||||
|
Reference in New Issue
Block a user