08/11/08 17:07:34
>>463
自己解決したのでメモ。
翻訳ドキュメントに書いてあったww
direct_to_template()の方が便利なのか?
*******************************************************************
Django の render_to_response() ショートカットを使っていて、
辞書オブジェクトを渡してコンテキストの変数を追加している場合、
テンプレートはデフォルトで (RequestContext ではなく) Context になります。
テンプレートのレンダリングに RequestContext を使うには、
render_to_response() の 3 つめの引数に RequestContext インスタンスを指定します。
コードは以下のようになるでしょう:
----------------------------------------------------------------
def some_view(request):
# ...
return render_to_response('my_template.html',
my_data_dictionary,
context_instance=RequestContext(request))
----------------------------------------------------------------
*******************************************************************