So I just finished the tourist attractions challenge but I have a doubt concerning the variable statename it is displayed like this in the views.py:
from django.shortcuts import render
# This is the dictionary for all the attractions
attractions = [
{ 'attraction_name' : 'Niagra Falls', 'state' : 'New York'},
{ 'attraction_name' : 'Grand Canyon National Park', 'state' : 'Arizona'},
{ 'attraction_name' : 'Mall of America', 'state' : 'Minnesota'},
{ 'attraction_name' : 'Mount Rushmore', 'state' : 'South Dakota'},
{ 'attraction_name' : 'Times Square', 'state' : 'New York'},
{ 'attraction_name' : 'Walt Disney World', 'state' : 'Florida'}
]
def home(request):
# The context is all of the variables we want passed into the template.
context = {"attractions" : attractions}
return render(request, 'tourist_attractions/home.html', context)
def details(request, statename):
# We replace the dash with a space for later ease of use. The dash is there because of the slugify filter.
context = {"attractions" : attractions, "statename" : statename.replace("-", " ")}
return render(request, 'tourist_attractions/details.html', context)
But what exactly is that variable? Cuz I can see that attractions is a list of dictionaries, for example. I think I’m missing something here.