feat: group states into predefined state types

This commit is contained in:
pablohashescobar 2022-12-13 23:20:43 +05:30
parent e36641cbf0
commit cb640407b6
2 changed files with 14 additions and 6 deletions

View File

@ -90,12 +90,10 @@ class ProjectViewSet(BaseViewSet):
## Default states
states = [
{"name": "Backlog", "color": "#5e6ad2", "sequence": 15000},
{"name": "ToDo", "color": "#eb5757", "sequence": 25000},
{"name": "Started", "color": "#26b5ce", "sequence": 35000},
{"name": "InProgress", "color": "#f2c94c", "sequence": 45000},
{"name": "Done", "color": "#4cb782", "sequence": 55000},
{"name": "Cancelled", "color": "#cc1d10", "sequence": 65000},
{"name": "Todo", "color": "#eb5757", "sequence": 25000},
{"name": "In Progress", "color": "#26b5ce", "sequence": 35000},
{"name": "Done", "color": "#f2c94c", "sequence": 45000},
{"name": "Cancelled", "color": "#4cb782", "sequence": 55000},
]
State.objects.bulk_create(

View File

@ -12,6 +12,16 @@ class State(ProjectBaseModel):
color = models.CharField(max_length=255, verbose_name="State Color")
slug = models.SlugField(max_length=100, blank=True)
sequence = models.FloatField(default=65535)
group = models.CharField(
choices=(
("backlog", "Backlog"),
("unstarted", "Unstarted"),
("started", "Started"),
("completed", "Completed"),
("cancelled", "Cancelled"),
),
default="backlog",
)
def __str__(self):
"""Return name of the state"""