I am new to Odoo. I'm currently using v12 of Odoo. How to render a template variable in XML like it is done in Django?
e.g. views.py
def function_name(self):
context={
'something':something
}
.
.
return render(request, "index.html", context)
e.g. index.html
{% for item in context %}
<p>{{ item.something }}</p>
{% endfor %}
How to render this in Odoo XML and how to pass the context variable from python file?
The template code example you provided looks like Jinja2 which is used by Django, Flask, etc. I believe Jinja can be used within certain areas, but you should be using Qweb for the most part within Odoo.
Qweb example:
<div>
<t t-if='condition'>
<operations>
</t>
</div>
Here's a good article on Qweb in Odoo 12