Https://www.codecademy.com/paths/build-python-web-apps-with-django/tracks/templates-in-django/modules/django-templates/projects/django-tourist-attractions-with-templates

Django project: tourist attractions

I cannot get the if statement to filter the attractions by state (step 17)

Here is my code:

{% extends “tourist_attractions/base.html” %}
{% load static %}

{% block head %}

This is a list of tourist attractions for {{statename}}

{% if item.state|lower == statename %}

{% endif %}
Attraction State
{{item.attraction_name}} {{item.state}}

{% endblock %}

Hi,

I think this is connected to how some names of states are handled in Django.
For example, “New York” must be transformed in “new-york” to be correctly matched.
If you have a look, you will notice that the filters is not needed with names like “Arizona” (no spaces).
Hope it helps!