How to use the river.models.proceeding.Proceeding function in river

To help you get started, we’ve selected a few river examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github javrasya / django-river / river / services / proceeding.py View on Github external
def has_user_any_action(content_type, user):
        """
        :param content_type_id:
        :param field_id:
        :param user_id:
        :return: Boolean value indicates whether the user has any role for the content type are sent. Any elements existence
          accepted, rejected or pending for the user, means the user in active for the content type.
        """
        proceedings = Proceeding.objects.filter(
            Q(transactioner=user) | Q(permissions__in=user.user_permissions.all()) | Q(groups__in=user.groups.all())).filter(content_type=content_type)
        return proceedings.count() != 0
github javrasya / django-river / river / services / proceeding_meta.py View on Github external
def apply_new_proceeding_meta(new_proceeding_meta):
        if new_proceeding_meta.proceedings.count() == 0:
            content_type = new_proceeding_meta.content_type
            WorkflowObjectClass = content_type.model_class()
            Proceeding.objects.bulk_create(
                list(
                    Proceeding(
                        workflow_object=workflow_object,
                        meta=new_proceeding_meta,
                        content_type=content_type
                    )
                    for workflow_object in WorkflowObjectClass.objects.all()
                )
github javrasya / django-river / river / models / proceeding_track.py View on Github external
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)