Django: How to track a linear (but flexible) project management process?

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") #Indicates which user needs to respond next.  Will be sales_rep, sales_mgr, or project_mgr.
    sales_rep = models.ForeignKey(User, related_name="sales_rep_projects") #choices limited to "Sales Rep" Group  
    sales_mgr = models.ForeignKey(User, related_name="sales_mgr_projects") #choices limited to "Sales Manager" Group 
    project_mgr = models.ForeignKey(User, related_name="project_mgr_projects") #choices limited to "Project Manager" Group
    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) #Automatically assigned according to the user response.  Includes things like "On Track", "On Hold", "Rejected", "Accepted", etc.

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)

, . , , , , , -. ! , - .

+3
1

Step. . , , (, , ). , - :

class Step(models.Model):
    name = models.CharField(max_length=50)
    responsible_role = models.CharField(max_length=50) # this contains 'sales_rep', 'sales_mgr' etc
    allowed_actions = models.ManyToManyField('AllowedAction')

class AllowedAction(models.Model):
    name = models.CharField(max_length=50)
    next_step = models.ForeignKey('Step') # the next step, if this action is chosen

:

class ProjectHistoryStep(models.Model):
    timestamp = models.DateTimeField()
    step = models.ForeignKey('Step')
    project = models.ForeignKey('Project')  

( , get_next_by_FOO).

, ( Project ) - , ( ProjectHistoryStep ), , .

+1

Source: https://habr.com/ru/post/1760401/


All Articles