44 lines
952 B
Python
44 lines
952 B
Python
from django.db import models
|
|
|
|
from evolus.models import Version
|
|
|
|
|
|
class Process(models.Model):
|
|
process_type = models.CharField(max_length=50)
|
|
document_version = models.ForeignKey(Version)
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
if not self.pk and not self.process_type:
|
|
self.process_type = self.PROCESS_TYPE
|
|
|
|
def __str__(self):
|
|
return self.process_type
|
|
|
|
|
|
class Task(models.Model):
|
|
assigned_to = models.EmailField()
|
|
process = models.ForeignKey(Process)
|
|
|
|
def __str__(self):
|
|
return '{} - {}'.format(self.process, self.assigned_to)
|
|
|
|
|
|
class Review(Process):
|
|
PROCESS_TYPE = 'Review'
|
|
|
|
def __str__(self):
|
|
return 'Review: {}'.format(self.document_version)
|
|
|
|
|
|
class Approval(Process):
|
|
PROCESS_TYPE = 'Approval'
|
|
|
|
|
|
class GatherComments(Process):
|
|
PROCESS_TYPE = 'GatherComments'
|
|
|
|
|
|
class Knowledge(Process):
|
|
PROCESS_TYPE = 'Knowledge'
|