Relative Content

Tag Archive for jinja2

JInja prints “” when for loop does not find the item

I have a jinja2 template that has the following code. This code is suppose to loop thru a dictionary and search for a component_class == BSW_PROJECT. In this instance BSW_PROJECT is not present and is not expected to be in the dictionary for one project but other projects will have BSW_PROJECT in the dictionary. When the template run it prints “” since it can’t find BSW_PROJECT in the dictionary.

JInja prints “” when for loop does not find the item

I have a jinja2 template that has the following code. This code is suppose to loop thru a dictionary and search for a component_class == BSW_PROJECT. In this instance BSW_PROJECT is not present and is not expected to be in the dictionary for one project but other projects will have BSW_PROJECT in the dictionary. When the template run it prints “” since it can’t find BSW_PROJECT in the dictionary.

JInja prints “” when for loop does not find the item

I have a jinja2 template that has the following code. This code is suppose to loop thru a dictionary and search for a component_class == BSW_PROJECT. In this instance BSW_PROJECT is not present and is not expected to be in the dictionary for one project but other projects will have BSW_PROJECT in the dictionary. When the template run it prints “” since it can’t find BSW_PROJECT in the dictionary.

JInja prints “” when for loop does not find the item

I have a jinja2 template that has the following code. This code is suppose to loop thru a dictionary and search for a component_class == BSW_PROJECT. In this instance BSW_PROJECT is not present and is not expected to be in the dictionary for one project but other projects will have BSW_PROJECT in the dictionary. When the template run it prints “” since it can’t find BSW_PROJECT in the dictionary.

Displaying the parameters passed to the function. Djangojinja

I’m at the beginning of learning django and jinja.
In the tutorials I see how the necessary data is transmitted when the button is clicked (onclick or click Listener). In any case if I open the elements via f12 I see the parameter values that are passed to the function. Is this method correct?

make all if statements true in jinja2 templates

I am writing a jinja2 template validator where I want to check all possibly needed variables. I already implemented my own Undefined class and can successfully detect missing variables but obviously variables within if-statements are not found.
I do not want to hardcode multiple if-else-cases so I am wondering if there is a jinja2-way to make all if-statements true so that I do not check the “else” cases only.
Maybe a way to temporary overwrite the jinja2 function for the {% if %} or something?

unable to render jinja template properly

I have issue with jinja template rendering, I have my jinja template something like this
I am trying to render virtual service yaml , but I am unable to render