Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Customizing Django Templates Template Tags and Filters Blocks and Inheritance

Diane Leigh
Diane Leigh
16,813 Points

Can someone please tell me why this code is failing?

Now, in the "list.html" template, extend "layout.html" (which is in the "code_challenges" directory). Here is my code: {% extends "code_challenges/layout.html" %}

<html> <head> <title>Code Challenge</title> </head> <body> <div class="page-header"> {% block header %} {% endblock %} </div> </body> </html>

I keep getting this message: Bummer! We accessed list.html, but can't find the content of layout.html. Did you extend "code_challenges/layout.html" within list.html? I've tried "..." I've tried '...' I'm sure it is something silly, but I have no idea what!

code_challenges/templates/code_challenges/layout.html
{% extends "code_challenges/layout.html" %}

<html>
    <head>
        <title>Code Challenge</title>
    </head>
    <body>
        <div class="page-header">
          {% block header %}
          {% endblock %}
        </div> 
    </body>
</html>
code_challenges/templates/code_challenges/list.html

1 Answer

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

You get the error message because you're adding the extends in layout.html instead of list.html

Just a tip: Some of the challenges are very sensitive and fails if doing anything special/extra

  • in your code you wrote {% extends "code_challenges/layout.html" %}
  • but it should be {% extends "layout.html" %}