Djangoのテンプレートに値を動的に渡したいのですが、次のコードがあります。 いくつかの提案をお願いします。コンテキスト値をDjangoのテンプレートをインクルードする方法
view.py
account_detail(request):
url = request.get_full_path()
temp = url.split('/')
id1 = int(temp[2])
print url
info = Patient_details.objects.get(id=id1)
context = Context({'info': info,'id':id1})
return render(request, 'patient/dashboard_d.html', context)
にtemplate1:
{% include "sidebar.html" with url={{ id }}%}
template2: 推測として<li><a href="../../{{ url }}/dashboard">Dashboard</a></li>
あなたが解決しようとしている*正確な問題は何ですか? – Sayse
私は上記に言及しています。質問を投票してから投票してください。親テンプレートに含めるテンプレートに値を動的に渡したい。 –
あなたが尋ねていることは不明です。あなたが「動的に」渡そうとしている「価値」は何ですか? – Sayse