Category "jinja2"

Merge 2 json arrays based on their keys

How can I merge 2 json arrays based on the same keys and add a 3rd item from the input json pog_id in the output json file? I have tried with the code mentioned

How to redirect the user back to the home page using FastAPI, after submitting an HTML form?

I have a page with a table of students. I added a button that allows you to add a new row to the table. To do this, I redirect the user to a page with input for

In salt states, we use "grains.host" to get the host details. How do we get the AWS EC2 availability zone name using salt grains?

In salt states, we use "grains.host" to get the host details. How do we get the AWS EC2 availability zone name using salt grains? To get the hostname I give the

Apache Airflow: How to template Volumes in DockerOperator using Jinja Templating

I want to convey list of volumes into DockerOperator using Jinja template: hard coded volumes works fine: volumes=['first:/dest', 'second:/sec_destination'] ho

passing a filename as a parameter from a for loop in python flask

I am uploading file so i am trying to pass a filename after looping through but i am getting an unbountLocalerror. i have tried making the filename global so th

using Django "include" template tag as nested - side effects?

Does anyone know or have any experience about bad side effects of using "nested include tags"? (I mean including a template file which itself includes another t

Flask: How to pass values to base.html?

Some data needs to be present in all templates. How can I transfer the data I need to base.html? For normal templates I use the render() function. I do not unde

jinja2 using {if} within {for}

I'm trying to make a template which iterates over a list to check if a string exists. if it does then something happens, if the string isn't in the list, somet

How to prevent Jinja2 substitution in Ansible playbook?

In my playbook, a JSON file is included using the include_vars module. The content of the JSON file is as given below: { "Component1": { "parameter1" : "

Why do I lose bootstrap styling when passing variables through URL in Flask?

When I pass a variable in Flask my Bootstrap styling doesn't work. If I use a normal app route without the variable the styling works. The relevant code is as f

How to use url_for() to pass path and query data to a route using FastAPI and Jinja2

I want to call a FastAPI route from a jinja2 template and pass both path and query data to the called route. All my attempts fail. I tried something in the jinj

Pyinstaller Import Issues with Jinja2

There are a couple post in regards to Pyinstaller having issuing recognizing jinja2, unfortunately none have resolved my issue. Ideally if Pyinstaller supports

loop.nextitem doesn't work with current value from data

I need to compare postback.campaign_id with the value of the next item. If it's similar, then, I don't print nothing, if not, then, print my row. But, this code

How to compare more than two lists have the same values in same indexes in Ansible?

I would like to compare more than 2 lists, and see if they have the same values in same indexes. I have the previous questions regarding how I can alternate the

Can I pass non-string types via environment variables to meta.yaml?

I am aware that conda's meta.yaml file uses jinja templating, which allows us to pass values to it via environment variables. For example like this: package:

How to sort version numbers in Ansible

I'm building an Ansible playbook in which I want to make a backup of a database in case I need to upgrade the software. For this I want to compare the highest v

'if' statement in jinja2 template

I'm trying to write an if statement in jinja template: {% for key in data %} {% if key is 'priority' %} <p>('Priority: ' + str(data[key])</

Parameter name is changed in bin_params using JinjaSql

Imagine this is my query : query = ''' SELECT * FROM table WHERE id = {{myid}}''' params = {'myid':3} j= JinJaSql(param_style='pyformat

Frozen-Flask, url_for() in Jinja2 and string concatenation during build

When running Flask normally, everything described below works absolutely fine. When running a build in Frozen-Flask however, I run into the following issue: In

Jinja2 template in Python 3 renders bytes with "b" prefix and quotes

I'm upgrading a Flask app from python2 to python3, Jinja2 now renders bytes with trailing b and single quotes, e.g. b'a123' while I need them rendered as a123.