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

How to pass parameters into variables? #80

Open
chenyusheng opened this issue May 20, 2022 · 1 comment
Open

How to pass parameters into variables? #80

chenyusheng opened this issue May 20, 2022 · 1 comment

Comments

@chenyusheng
Copy link

chenyusheng commented May 20, 2022

hi, i got a problem in using busuness-rules.
i need to pass some parameters into variables so that the variables fun can query data from my database.
just like the actions can config some parm

@rule_action(params={"number_to_order": FIELD_NUMERIC})
 def order_more(self, number_to_order):
        ProductOrder.objects.create(product_id=self.product.id,quantity=number_to_order)

but it seems impossible to achieve.
what can i do?

@jreeter
Copy link

jreeter commented Oct 1, 2023

Instead of this action working on self.product, why not a self.order that contains the product id and the quantity?

def order_more(self):
        ProductOrder.objects.create(product_id=self.order.product_id,quantity=self.order.quantity)

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