Closed rickmedlin closed 2 years ago
Never mind, A little research showed that one solution is the ~ operator:
<img src="{{label_tools.qr_code(element_1 ~ element_2 ~ element_3)}}" />
Oh wow that sounds fancy, can you explain what it does?
Not really fancy. As shown above, if you want to join multiple values inside a 'qr_code' statement, concatenate them with a '~'.
I leave this here for future reference: https://jinja.palletsprojects.com/en/3.0.x/templates/#other-operators
~ (tilde)
Converts all operands into strings and concatenates them.
{{ "Hello " ~ name ~ "!" }} would return (assuming name is set to 'John') Hello John!.
The more I use this package, the more I like it. However I would like to put multiple elements in the QR code.
I've tried these ways without success in the Jinja / image template:
<img src="{{label_tools.qr_code(element_1, element_2, element_3)}}" />
<img src="{{label_tools.qr_code(element_1)}} {{label_tools.qr_code(element_2)}} {{label_tools.qr_code(element_3)}}" />
Is this possible?