I am developing a project management application in Django that requires a somewhat linear response process involving different user groups (as in Django auth Groups). Each step of the response process has several response options (most parameters unique to the step) and is assigned to the user within a specific group. The next step in the process is determined by the user's response, and sometimes additional information from one of the project members may be required.
The problem is that my current implementation seems rather cumbersome, and I'm sure there is a better way to track the response process. I was hoping that someone would be able to give some idea of a more reliable solution.
As a simple example, consider a project with the following user groups: Sales Rep, Sales Manager, and Project Manager. Models now look like this:
class Project(models.Model):
assigned_to = models.ForeignKey(User, related_name="projects_assigned_to")
sales_rep = models.ForeignKey(User, related_name="sales_rep_projects")
sales_mgr = models.ForeignKey(User, related_name="sales_mgr_projects")
project_mgr = models.ForeignKey(User, related_name="project_mgr_projects")
current_step = models.ForeignKey(Step, related_name="projects_with_current_step")
previous_step = models.ForeignKey(Step, related_name="projects_with_previous_step")
status = models.ForeignKey(Status)
class Step(models.Model):
name = models.CharField(max_length=50)
class Status(models.Model):
name = models.CharField(max_length=50)
Here is a simple overview of how this process can work:
- Sales Rep creates a new project and is assigned to the sales manager
- The sales manager is presented with the following options:
(a) approve the project or (b) request additional information from the sales representative. - If the project is approved, appoint a project manager who will be presented with the following options:
(a) start the project
(b) abandon the project
(c) request additional information from the sales representative or sales manager. - , , . , , ( current_step previous_step ). , , , (, , ).
10 .
, , . , , " " , . :
class Response(models.Model):
comment = models.TextField()
response_action = models.ForeignKey(ResponseAction)
submitted = models.DateTimeField()
class ResponseAction(models.Model):
""" I.e. 'Sales Manager approved the project', 'Project Manager commenced the project'"""
name = models.CharField(max_length=100)
, . , , , , , -. ! , - .