[Fixed]-Values of a dictionary in a dropdown

1👍

This line is causing the trouble:

return render_to_response(request,'soumi1.html',{'marketplaces':marketplaces})

You are returning marketplaces but your view is also called marketplaces.


Taking a guess I’d say you want to return the list of marketplaces.

You can do that in the following way:

marketplaces_list = SellerMarketplaces.objects.filter(seller_id=seller).values_list('mk_id__marketplace', flat=True)

return render_to_response(request,'soumi1.html',{'marketplaces':marketplaces_list})

Leave a comment