This is my code:
class Predict(views.APIView):
def post(self, request):
employeeId = 44
return render(request, 'InventoryShop/home.html', {'employeeId': employeeId})
What I want to achieve is to output this employeeId
on the home.html
, from this scope.
But this code gives an error when trying to run it:
context must be a dict rather than set.
When I put this employeeId
outside the scope, I am able to output it without problem though:
def home(request):
context = {
'employeeId' : employeeId
}
return render(request, 'InventoryShop/home.html', context)
Edit: I'm aware of the changes from 1.8 to 1.11