views.py:
def home(request):
return render(request, 'blog/home.html', {'title': 'HOME'}, {'post': posts})
In this code, only title works. when I took {'post': posts} before {'title': 'HOME'} , post works but title don't. I have to use both in templates. I'm a beginner in django. How can i fix this problem ?
You can only have one context dictionary, but a dictionary can have as many key/values as you want.
def home(request):
context = {'title': 'HOME','post': posts}
return render(request, 'blog/home.html',context)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With