# Path: django_workflow/utils.py
# def import_from(module, name):
#     module = __import__(module, fromlist=[name])
#     return getattr(module, name)
# 
# def import_from_path(full_path):
#     parts = full_path.rsplit(".", 1)
#     return import_from(parts[0], parts[1])


import ast
import numbers
from django.db.models.manager import Manager
from django_workflow.utils import import_from, import_from_path
        object = workflow.object_class().objects.get(id=object_id)
        attribute = getattr(object, attribute_name)
        return attribute.filter(**params).exists()
    else:
        raise ValueError("missing parameter attribute_name")


def user_attribute_filter_exist(*, workflow, object_id, user, object_state, **kwargs):
    params = parse_parameters(workflow=workflow, object_id=object_id, user=user, object_state=object_state, **kwargs)
    if "attribute_name" in params:
        attribute_name = params.pop('attribute_name')
        attribute = getattr(user, attribute_name)
        return attribute.filter(**params).exists()
    else:
        raise ValueError("missing parameter attribute_name")


def object_filter_exist(*, workflow, object_id, user, object_state, **kwargs):
    params = parse_parameters(workflow=workflow, object_id=object_id, user=user, object_state=object_state, **kwargs)
    return workflow.object_class().objects.filter(**params).exists()


def user_filter_exist(*, workflow, object_id, user, object_state, **kwargs):
    params = parse_parameters(workflow=workflow, object_id=object_id, user=user, object_state=object_state, **kwargs)
    return type(user).objects.filter(**params).exists()


def other_filter_exist(*, workflow, object_id, user, object_state, **kwargs):
    params = parse_parameters(workflow=workflow, object_id=object_id, user=user, object_state=object_state, **kwargs)
    if "model_type" in params:

# Path: django_workflow/utils.py
# def import_from(module, name):
#     module = __import__(module, fromlist=[name])
#     return getattr(module, name)
# 
# def import_from_path(full_path):
#     parts = full_path.rsplit(".", 1)
#     return import_from(parts[0], parts[1])


# Path: django_workflow/conditions.py
import ast
import numbers
from django.db.models.manager import Manager
from django_workflow.utils import import_from, import_from_path

        object = workflow.object_class().objects.get(id=object_id)
        attribute = getattr(object, attribute_name)
        return attribute.filter(**params).exists()
    else:
        raise ValueError("missing parameter attribute_name")


def user_attribute_filter_exist(*, workflow, object_id, user, object_state, **kwargs):
    params = parse_parameters(workflow=workflow, object_id=object_id, user=user, object_state=object_state, **kwargs)
    if "attribute_name" in params:
        attribute_name = params.pop('attribute_name')
        attribute = getattr(user, attribute_name)
        return attribute.filter(**params).exists()
    else:
        raise ValueError("missing parameter attribute_name")


def object_filter_exist(*, workflow, object_id, user, object_state, **kwargs):
    params = parse_parameters(workflow=workflow, object_id=object_id, user=user, object_state=object_state, **kwargs)
    return workflow.object_class().objects.filter(**params).exists()


def user_filter_exist(*, workflow, object_id, user, object_state, **kwargs):
    params = parse_parameters(workflow=workflow, object_id=object_id, user=user, object_state=object_state, **kwargs)
    return type(user).objects.filter(**params).exists()


def other_filter_exist(*, workflow, object_id, user, object_state, **kwargs):
    params = parse_parameters(workflow=workflow, object_id=object_id, user=user, object_state=object_state, **kwargs)
    if "model_type" in params:

        model_type = import_from_path(params.pop('model_type'))