ブロック{%block ...%}と{%endblock%}でテンプレートを拡張しようとしていますが、わかりませんどうすればWebページを表示できないのですか? これは私のindex.html
ベースページでメインのブロックを拡張するサブテンプレートを表示できませんfile.html
<!DOCTYPE html>
{% load staticfiles %}
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Libreria</title>
<link rel="stylesheet" href="{% static 'css/bootstrap.css' %}" />
<link rel="stylesheet" href="{% static 'css/bootstrap-theme.css' %}" />
<link rel="stylesheet" href="{% static 'css/index.css' %}" />
<link href="http://fonts.googleapis.com/css?family=Lobster&subset=latin,latin-ext" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="page-header">
<h1>Libreria Personale</h1>
</div>
<div class="content">
<div class="row">
<div class="col-md-8">
{% block content %}
{% endblock %}
</div>
</div>
</div>
</body>
</html>
私の私に含めるalbum.html
{% extends 'index.html' %}
{% block content %}
{% for album in albums %}
<div>
<h6>{{album.name}}</h6>
<ul>
<li>Artist: {{album.artist}}</li>
<li>Genre: {{album.genre}}</li>
<li>Songs: , </li>
<li>Vote: {{album.vote}}</li>
</ul>
</div>
<hr />
{% endfor %}
{% endblock %}
私のviews.py
...
def index(request):
albums = Album.objects.all()
artists = Artist.objects.all()
return render(request,'polls/index.html',{'albums':albums,'artists':artists})
すみませんが、私は上の何かを見つけることができませんでした私を助けるネット。
「album.html」をレンダリングしていますか?あなたはあなたの文脈を通して 'アルバムを渡していますか? –
こんにちは@CurtisOlson。私はちょうど私のビューファイルを挿入しました。どこにalbum.htmlを追加しなければならないのですか? –