Search code examples
djangotemplatestags

why i cant use template tags in django


I tried to loop the link and name in the list but it's not working, can someone explain to me why it is not working?

picture


Solution

  • because you don't pass your context data to your html file, pass it by doing this:

    def index(request):
        context = {
            "nav": [
                ["/", "Home"],
                ["/about", "About"],
                ["/blog", "Blog"],
            ],
        }
        return render(request, "index.html", context)