Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
PENDING = "pending"
CANCELLED = "cancelled"
JUMPED = "jumped"
DONE = "done"
STATUSES = [
(PENDING, _('Pending')),
(CANCELLED, _('Cancelled')),
(DONE, _('Done')),
(JUMPED, _('Jumped')),
]
LOGGER = logging.getLogger(__name__)
class Transition(BaseModel):
class Meta:
app_label = 'river'
verbose_name = _("Transition")
verbose_name_plural = _("Transitions")
objects = TransitionApprovalManager()
content_type = models.ForeignKey(app_config.CONTENT_TYPE_CLASS, verbose_name=_('Content Type'), on_delete=CASCADE)
object_id = models.CharField(max_length=50, verbose_name=_('Related Object'))
workflow_object = GenericForeignKey('content_type', 'object_id')
meta = models.ForeignKey(TransitionMeta, verbose_name=_('Meta'), related_name="transitions", on_delete=PROTECT)
workflow = models.ForeignKey(Workflow, verbose_name=_("Workflow"), related_name='transitions', on_delete=PROTECT)
source_state = models.ForeignKey(State, verbose_name=_("Source State"), related_name='transition_as_source', on_delete=PROTECT)
destination_state = models.ForeignKey(State, verbose_name=_("Destination State"), related_name='transition_as_destination', on_delete=PROTECT)
status = models.CharField(_('Status'), choices=STATUSES, max_length=100, default=PENDING)
PENDING = "pending"
APPROVED = "approved"
JUMPED = "jumped"
CANCELLED = "cancelled"
STATUSES = [
(PENDING, _('Pending')),
(APPROVED, _('Approved')),
(CANCELLED, _('Cancelled')),
(JUMPED, _('Jumped')),
]
LOGGER = logging.getLogger(__name__)
class TransitionApproval(BaseModel):
class Meta:
app_label = 'river'
verbose_name = _("Transition Approval")
verbose_name_plural = _("Transition Approvals")
objects = TransitionApprovalManager()
content_type = models.ForeignKey(app_config.CONTENT_TYPE_CLASS, verbose_name=_('Content Type'), on_delete=CASCADE)
object_id = models.CharField(max_length=50, verbose_name=_('Related Object'))
workflow_object = GenericForeignKey('content_type', 'object_id')
meta = models.ForeignKey(TransitionApprovalMeta, verbose_name=_('Meta'), related_name="transition_approvals", null=True, blank=True, on_delete=SET_NULL)
workflow = models.ForeignKey(Workflow, verbose_name=_("Workflow"), related_name='transition_approvals', on_delete=PROTECT)
transition = models.ForeignKey(Transition, verbose_name=_("Transition"), related_name='transition_approvals', on_delete=PROTECT)
from django.db import models
from django.utils.translation import ugettext_lazy as _
from mptt.fields import TreeOneToOneField
from river.models.proceeding import Proceeding
from river.models.base_model import BaseModel
__author__ = 'ahmetdal'
class ProceedingTrack(BaseModel):
class Meta:
app_label = 'river'
verbose_name = _("Proceeding Track")
verbose_name_plural = _("Proceeding Tracks")
proceeding = models.ForeignKey(Proceeding, verbose_name=_('Proceeding'), related_name="tracks")
process_date = models.DateTimeField(auto_now_add=True, null=True, blank=True)
previous_track = TreeOneToOneField("self", verbose_name=_('Previous track'), related_name="next_track", null=True, blank=True)
from __future__ import unicode_literals
from django.db import models
from django.db.models.signals import pre_save
from django.template.defaultfilters import slugify
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from river.models.base_model import BaseModel
from river.models.managers.state import StateManager
__author__ = 'ahmetdal'
@python_2_unicode_compatible
class State(BaseModel):
class Meta:
app_label = 'river'
verbose_name = _("State")
verbose_name_plural = _("States")
objects = StateManager()
slug = models.SlugField(unique=True, null=True, blank=True)
label = models.CharField(max_length=50)
description = models.CharField(_("Description"), max_length=200, null=True, blank=True)
def __str__(self):
return self.label
def natural_key(self):
return self.slug,
from django.db import models, transaction
from django.db.models import PROTECT
from django.db.models.signals import post_save, pre_delete
from django.utils.translation import ugettext_lazy as _
from river.config import app_config
from river.models import Workflow
from river.models.base_model import BaseModel
from river.models.managers.transitionmetada import TransitionApprovalMetadataManager
from river.models.transitionmeta import TransitionMeta
__author__ = 'ahmetdal'
class TransitionApprovalMeta(BaseModel):
class Meta:
app_label = 'river'
verbose_name = _("Transition Approval Meta")
verbose_name_plural = _("Transition Approval Meta")
unique_together = [('workflow', 'transition_meta', 'priority')]
objects = TransitionApprovalMetadataManager()
workflow = models.ForeignKey(Workflow, verbose_name=_("Workflow"), related_name='transition_approval_metas', on_delete=PROTECT)
transition_meta = models.ForeignKey(TransitionMeta, verbose_name=_("Transition Meta"), related_name='transition_approval_meta', on_delete=PROTECT)
permissions = models.ManyToManyField(app_config.PERMISSION_CLASS, verbose_name=_('Permissions'), blank=True)
groups = models.ManyToManyField(app_config.GROUP_CLASS, verbose_name=_('Groups'), blank=True)
priority = models.IntegerField(default=0, verbose_name=_('Priority'), null=True)
parents = models.ManyToManyField('self', verbose_name='parents', related_name='children', symmetrical=False, db_index=True, blank=True)
from django.db import models
from django.utils.translation import ugettext_lazy as _
from river.models.base_model import BaseModel
__author__ = 'ahmetdal'
class Callback(BaseModel):
class Meta:
app_label = 'river'
verbose_name = _("Callback")
verbose_name_plural = _("Callbacks")
hash = models.CharField(_('Hash'), max_length=200, unique=True)
method = models.CharField(_('Callback Method'), max_length=200)
hooking_cls = models.CharField(_('HookingClass'), max_length=200)
enabled = models.BooleanField(_('Enabled'), default=True)
from django.db import models
from django.db.models import CASCADE
from django.db.models.signals import m2m_changed, post_save
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from river.config import app_config
from river.models.base_model import BaseModel
from river.models.managers.proceeding_meta import ProceedingMetaManager
from river.models.transition import Transition
__author__ = 'ahmetdal'
@python_2_unicode_compatible
class ProceedingMeta(BaseModel):
class Meta:
app_label = 'river'
verbose_name = _("Proceeding Meta")
verbose_name_plural = _("Proceeding Metas")
unique_together = [('content_type', 'transition', 'order')]
objects = ProceedingMetaManager()
content_type = models.ForeignKey(app_config.CONTENT_TYPE_CLASS, verbose_name=_('Content Type'), on_delete=CASCADE)
transition = models.ForeignKey(Transition, verbose_name=_('Transition'), on_delete=CASCADE)
permissions = models.ManyToManyField(app_config.PERMISSION_CLASS, verbose_name=_('Permissions'), blank=True)
groups = models.ManyToManyField(app_config.GROUP_CLASS, verbose_name=_('Groups'), blank=True)
order = models.IntegerField(default=0, verbose_name=_('Order'), null=True)
action_text = models.TextField(_("Action Text"), max_length=200, null=True, blank=True)
__author__ = 'ahmetdal'
PENDING = "pending"
APPROVED = "approved"
CANCELLED = "cancelled"
STATUSES = [
(PENDING, _('Pending')),
(APPROVED, _('Approved')),
(CANCELLED, _('Cancelled')),
]
LOGGER = logging.getLogger(__name__)
class TransitionApproval(BaseModel):
class Meta:
app_label = 'river'
verbose_name = _("Transition Approval")
verbose_name_plural = _("Transition Approvals")
objects = TransitionApprovalManager()
content_type = models.ForeignKey(app_config.CONTENT_TYPE_CLASS, verbose_name=_('Content Type'), on_delete=CASCADE)
object_id = models.CharField(max_length=50, verbose_name=_('Related Object'))
workflow_object = GenericForeignKey('content_type', 'object_id')
meta = models.ForeignKey(TransitionApprovalMeta, verbose_name=_('Meta'), related_name="transition_approvals", null=True, blank=True, on_delete=SET_NULL)
workflow = models.ForeignKey(Workflow, verbose_name=_("Workflow"), related_name='transition_approvals', on_delete=PROTECT)
source_state = models.ForeignKey(State, verbose_name=_("Source State"), related_name='transition_approvals_as_source', on_delete=PROTECT)