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 (

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 %}

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

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 file.

Hope this helps.


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.