mymaster.html
views.py
template.html
<!DOCTYPE html>
<html>
<body>
{% block myheading %}
{% endblock %}
{% block mymessage %}
{% endblock %}
<p>Check out the two templates to see what they look like,
and views.py to see the reference to the child template
and to see how the members variable looks like.</p>
</body>
</html>
from django.http import HttpResponse
from django.template import loader
from .models import Member
def testing(request):
mymembers = Member.objects.all().values()
template = loader.get_template('template.html')
context = {
'members': mymembers,
}
return HttpResponse(template.render(context, request))
{% extends 'mymaster.html' %}
{% block myheading %}
<h1>Members</h1>
{% endblock %}
{% block mymessage %}
<ul>
{% for x in members %}
<li>{{ x.firstname }}</li>
{% endfor %}
</ul>
{% endblock %}