Passing a query-set instead of an object in variables.py (Bulk Support) #36
Open
Description
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() ?
Metadata
Assignees
Labels
No labels