Django multiple contexts within a single view

django, python

Solution

You have almost got it right. Just change

return render(request, 'polls/productpage.html', {'product': product}, {'image':image})

to

return render(request, 'polls/productpage.html', {'product': product, 'image':image})

Problem

I want to have something like this, where the context draws from multiple models used in a single view. How is this possible? ``` def productpage(request, product_image_id): product = get_object_or_404(Product, pk=product_image_id) image = get_object_or_404(Image, pk=product_image_id) return render(request, 'polls/productpage.html', {'product': product}, {'image':image}) ``` this code is invalid as it stands but exemplifies what I am looking to do

Original source