Skip to content

Commit a2204a3

Browse files
committed
pulled out status definition into constants
1 parent 243576e commit a2204a3

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

activflow/core/constants.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
REQUEST_IDENTIFIER = 'Initial'
44

5+
REQUEST_STATUS = (
6+
('Initiated', 'Initiated'),
7+
('Withdrawn', 'Withdrawn'),
8+
('Completed', 'Completed')
9+
)
10+
11+
TASK_STATUS = (
12+
('Not Started', 'Not Started'),
13+
('In Progress', 'In Progress'),
14+
('Rolled Back', 'Rolled Back'),
15+
('Completed', 'Completed')
16+
)
517
# register workflow apps here
618
# enable 'tests' app only for manual testing purpose
719

activflow/core/models.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
OneToOneField,
99
ForeignKey)
1010

11+
from activflow.core.constants import (
12+
REQUEST_STATUS,
13+
TASK_STATUS)
14+
1115
from activflow.core.helpers import (
1216
flow_config,
13-
transition_config
14-
)
17+
transition_config)
1518

1619

1720
class AbstractEntity(Model):
@@ -54,10 +57,8 @@ class Request(AbstractEntity):
5457
"""Defines the workflow request"""
5558
requester = ForeignKey(User, related_name='requests')
5659
module_ref = CharField(max_length=100)
57-
status = CharField(verbose_name="Status", max_length=30, choices=(
58-
('Initiated', 'Initiated'),
59-
('Withdrawn', 'Withdrawn'),
60-
('Completed', 'Completed')))
60+
status = CharField(
61+
verbose_name="Status", max_length=30, choices=REQUEST_STATUS)
6162

6263

6364
class Task(AbstractEntity):
@@ -66,11 +67,8 @@ class Task(AbstractEntity):
6667
assignee = ForeignKey(Group)
6768
updated_by = ForeignKey(User)
6869
activity_ref = CharField(max_length=100)
69-
status = CharField(verbose_name="Status", max_length=30, choices=(
70-
('Not Started', 'Not Started'),
71-
('In Progress', 'In Progress'),
72-
('Rolled Back', 'Rolled Back'),
73-
('Completed', 'Completed')))
70+
status = CharField(
71+
verbose_name="Status", max_length=30, choices=TASK_STATUS)
7472

7573
@property
7674
def activity(self):

0 commit comments

Comments
 (0)