Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Template Inheritance

In this lesson, you’ll learn about template inheritance as well as a common software development principle: DRY (Don’t Repeat Yourself). Django’s template inheritance allows you to write a particular bit of code only once in one place and then inherit from there to the other places where you want to use it.

Comments & Discussion

Gascowin on Oct. 21, 2019

I accidentally (or shall i say intentionally) included

{% load static %} 

in base.html since it gets used in the other templates as well but ended up with another one of our “friends”; “TemplateSyntaxError”. The error asks “did you forget to register or load this tag?”

Am I missing something here?…or does this approach not work for ‘static’ files? Thanks.

Martin Breuss RP Team on Oct. 23, 2019

Are you still doing {% load static %} also in the child templates? I assume you are probably running into this situation.

Become a Member to join the conversation.