我有幾個觀點,每個人都必須呈現動態菜單是這樣的:渲染動態菜單中每個視圖
def view1(request):
return render_to_response('view1.html',
RequestContext(request, {'menu': menu, 'a': a, ...}))
def view2(request):
return render_to_response('view2.html',
RequestContext(request, {'menu': menu, 'b': b, ...}))
def view3(request):
return render_to_response('view3.html',
RequestContext(request, {'menu': menu, 'c': c, ...}))
def viewN(request):
return render_to_response('view4.html',
RequestContext(request, {'menu': menu, 'd': d, ...}))
但它是incomfortable怎麼一回事,因爲我不得不菜單屬性添加到每個視圖。我可以通過哪種方式進行優化?