Jinja2 template not rendering if-elif-else statement properly
Stack How?
Stackorigin – The Community of Question and Answers Latest Articles
Read More About Python List Comprehension with examples
Python List Comprehension: Python List comprehension provides a much more short syntax for creating a new list based on the values of an existing list. Advantages of List Comprehension in Python: Time Efficient than loop Space Efficient than loop Needs ...
Do not accept an offer letter from companies.
Do not accept an offer letter from companies without verifying the following points. Designation Salary Details & CTC Distribution Leave Policies Working Hours & Days Medical Coverage/Insurance Probation Period Notice Period Benefits and Perks Bonus F&F Policy
How to call API using Ajax
AJAX stands for Asynchronous JavaScript and XML and its used for to make calls to the server to fetch some data. In this article, we will learn how to implement a simple API call using AJAX technology. How to use GET ...
Jinja2 template not rendering if-elif-else statement properly:
You are testing if the values of the variables
error
andAlready
are present inRepoOutput[RepoName.index(repo)]
. If these variables don’t exist then an undefined object is used.Both of your
if
andelif
tests therefore are false; there is no undefined object in the value of RepoOutput[RepoName.index(repo)].I think you wanted to test if certain strings are in the value instead:
Other corrections I made:
{% elif ... %}
instead of{$ elif ... %}
.</tr>
tag out of theif
conditional structure, it needs to be there always.id
attributeNote that most likely you want to use a
class
attribute instead here, not anid
, the latter must have a value that must be unique across your HTML document.Personally, I’d set the class value here and reduce the duplication a little: