Reputation: 1436
I originally thought I would use {% extends ["filename.html"] %} to take html I've written in a template and put it into my main file, but since you can only use "extends" once, how can I have it so that my sidebar.html
and slider.html
are like snippets that can be put into my main html file, which I've called list.html
Here's an image of what things look like now: http://imgur.com/K5XKAcQ Here's an image of the error: http://imgur.com/Uqs3iQo
Upvotes: 0
Views: 125
Reputation: 1394
You can use include in the main template
Rather than adding a tag in the sidebar.html
, in filename.html
, add:
{% include "sidebar.html" %}
Upvotes: 0
Reputation: 1910
Use "extends" like referencing a base class. Multiple-inheritance isn't supported (directly). To include snippets of code in your content, use "include":
{% extends "layout.html" %}
{% include "sidebar.html" %}
{% include "slider.html" %}
See: https://docs.djangoproject.com/en/dev/ref/templates/builtins/
Upvotes: 4