Размещение значений словаря внутри таблицы в шаблоне Django

Это мой первый раз, когда я использую шаблон Django. Я пытаюсь сделать таблицу внутри моей страницы со значениями из словаря, который я создал, используя API.

Вот как я отправляю данные внутри моего views.py:

    data = {
    "year_most_launches": result_launches,
    "launch_sites":response_sites,
    "launches_2019_2021":response_2019_2021
    }
return render(request,"main/launches.html", {"data":data})

Вот как выглядит моя html страница:

            <table class="table">
            <thead>
                <tr>
                    <th>Year with most launches</th>
                    <th>Launch site with most launches</th>
                    <th>Number of launches between 2019 and 2021</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>{{ data["year_most_launches"] }}</td>
                    <td>{{ data["launch_sites"] }}</td>
                    <td>{{ data["launches_2019_2021"] }}</td>
                </tr>  
            </tbody>
        </table>

Но я получаю следующую ошибку django.template.exceptions.TemplateSyntaxError: Could not parse the remainder: '["year_most_launches"]' from 'data["year_most_launches"]'

Как я могу решить эту проблему? Кто-нибудь может помочь?

            <table class="table">
        <thead>
            <tr>
                <th>Year with most launches</th>
                <th>Launch site with most launches</th>
                <th>Number of launches between 2019 and 2021</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>{{ year_most_launches }}</td>
                <td>{{ launch_sites }}</td>
                <td>{{ launches_2019_2021 }}</td>
            </tr>  
        </tbody>
    </table>

также вы можете использовать цикл for в шаблоне

Вернуться на верх