One of my all favorite template tricks goes back to my LJ World days.

Most people don't realize that the extends tag accepts a variable and not just a hard-coded literal value. This allows for magical things to happen when combined with a default.



The following block extends a base template named "base.html" if the base_template is not set.