Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing a query-set instead of an object in variables.py (Bulk Support) #36

Open
jdsinh opened this issue Nov 7, 2016 · 1 comment
Open

Comments

@jdsinh
Copy link

jdsinh commented Nov 7, 2016

variables.py

class ProductVariables(BaseVariables):

    def __init__(self, product):
        self.product = product

from business_rules import run_all

rules = _some_function_to_receive_from_client()

for product in Products.objects.all():
    run_all(rule_list=rules,
            defined_variables=ProductVariables(product),
            defined_actions=ProductActions(product),
            stop_on_first_trigger=True
           )

Instead of passing a single product object to this above class from run_all(), is there any way that we can pass whole Query-set of Product model from run_all() method in a way that a bulk support can be added instead of iterating through each product object in run_all() ?

@achandak33
Copy link

Were you able to find a solution or a workaround for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants