# for key,value not working in template

**URL:** <https://forum.djangoproject.com/t/for-key-value-not-working-in-template/42853>\
**Category:** Templates & Frontend\
**Created:** [September 16, 2025, 7:03am UTC](https://forum.djangoproject.com/t/for-key-value-not-working-in-template/42853 "2025-09-16T07:03:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alainroger91100](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/alainroger91100/32/29909_2.png) [@alainroger91100](https://forum.djangoproject.com/u/alainroger91100)\
**Post date:** [September 16, 2025, 7:03am UTC](https://forum.djangoproject.com/t/for-key-value-not-working-in-template/42853/1 "2025-09-16T07:03:24Z")

</div>

Hi,

I have a function in my view that should render a page with some data from a dictionary.

my function use render for this purpose as following:

```python
def welcome_page(request):

    return render(request, "jobportal/index.html",regions)

```

where regions is:

```python
regions = {

“France”: 30534,

“Spain”: 13614,

“Italy": 93474

}

```

regions is defined in the same view as my function welcome page.

in my template I have thefollowing code:

```python
<ul>

  {% for key, value in regions.items %}

  <li>{{ key }} : {{ value }}</li>

  {% endfor %}

</ul>

```

while the template works (display my other section of the page, I’m not able to get regions displayed correctly.

I read the documentation as also several examples and it seems that everything is good. So why don’t I get regions displayed ?

thx

---

<div class="post-metadata">

**Author:** ![carltongibson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/carltongibson/32/267_2.png) [@carltongibson](https://forum.djangoproject.com/u/carltongibson)\
**Post date:** [September 16, 2025, 8:06am UTC](https://forum.djangoproject.com/t/for-key-value-not-working-in-template/42853/2 "2025-09-16T08:06:05Z")

</div>

> [@alainroger91100](#):
>
> `render(request, "jobportal/index.html",regions)`

`render` takes a `context` within which you should have your `regions`…

`render(request, "jobportal/index.html",{"regions": regions})`

Then I think it should work.

---

<div class="post-metadata">

**Author:** ![alainroger91100](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/alainroger91100/32/29909_2.png) [@alainroger91100](https://forum.djangoproject.com/u/alainroger91100)\
**Post date:** [September 16, 2025, 10:58am UTC](https://forum.djangoproject.com/t/for-key-value-not-working-in-template/42853/3 "2025-09-16T10:58:47Z")

</div>

Yes, you’re right. I was confused with “double” word “regions”. thx for saving me 🙂
