Django Tourist Attraction

I’ve been working through the Django course and I’m struggling on step 15 of the final project for the templates chapter (https://www.codecademy.com/paths/build-python-web-apps-with-django/tracks/templates-in-django/modules/django-templates/projects/django-tourist-attractions-with-templates).

I’ve got everything working up to this step but can’t seem to figure out how to reference the state name that’s passed in the url from home.html to details.html. The code in home.html that links to details.html is:

<a href="{% url 'details' item.state|slugify %}">State details</a>

and the code in details.html is:

{% extends "tourist_attractions/base.html" %}

{% load static %}

<head>
  {% block head %}
  <link rel="stylesheet" href="{% static 'tourist_attractions/style.css' %}">
  {% endblock %}
</head>
<body>
  {% block content %}
  <h1>This is a list of tourist attractions for {{ HERE }}</h1>
  {% endblock %}
</body>

The ‘HERE’ bit is where I’m struggling, the state name is in the url but I’m unsure how to reference this passed parameter?

The variable name that goes into the {{ HERE }} is {{ statename }}.
You can see this being passed down in the details function definition within the views.py file.

Hope this helps.

3 Likes

They seriously need to put that in the hint section of that exercise…the hint is literally not even a hint and I had to come here to figure this out…

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.