Home Forums BB Form Use FOR-IF Construct in Jinja2 Loops

Viewing 1 post (of 1 total)
  • Author
    Posts
  • augustusholden
    Guest
    Post count: 2895

    When setting out strings, you have to tell the renderer that it is a value of type string, not statements of Jinja. You do this by enclosing the string in either single quotations ‘Example’ or double quotations “Example”. Before you can use your variable, it first needs to be initialized. However, you always need to initialize your variables with value. For instance, will create a variable called favouriteAnimal and save the word “duck” in it. Then you will be able to use the variable throughout your code by simply typing the variables name. Here my_item is a loop variable that will be taking values as we go over the elements. And my_collection is the name of the variable holding reference to the iterated collection. Any content placed between is bypassed by Jinja and doesn’t appear in the final rendered web page. To add parts of template depending on the presence of variables in data dictionary. ¶Filters a sequence of objects by applying a test to the specified attribute of each object, and only selecting the objects with the test succeeding. ¶Filters a sequence of objects by applying a test to the specified attribute of each object, and rejecting the objects with the test succeeding. However, the current template cannot override any blocks that the included template outputs.

Viewing 1 post (of 1 total)
Reply To: Use FOR-IF Construct in Jinja2 Loops
Your information: