Skip to content

Instantly share code, notes, and snippets.

@rtuita23
Created February 16, 2015 04:39
Show Gist options
  • Save rtuita23/5f0b21acea6d8a4101ad to your computer and use it in GitHub Desktop.
Save rtuita23/5f0b21acea6d8a4101ad to your computer and use it in GitHub Desktop.
Template
<!DOCTYPE html>
<html>
<head>
<title>Flask Template Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
div#main {
max-width: 500px;
padding: 20px;
}
nav .title {
font-weight: bold;
}
a.active {
font-weight: bold;
}
</style>
</head>
<body>
<div id="main">
{% extends "base.html" %}
{% block content %}
<h3> This is the start of my child template</h3>
<br>
<p>My string: {{my_string}}</p>
<p>Value from the list: {{my_list[1]}}</p>
<p>Loop through the list:</p>
<ul>
{% for n in my_list %}
<li>{{n}}</li>
{% endfor %}
</ul>
<h3> This is the end of my child template</h3>
{% endblock %}
</div>
</body>
{% block footer %}
{{super()}}
...and this addition to the footer is coming from the child template.
{% endblock %}
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment