这是我的代码:
# Select the players from the database and for each of them set the boolean field state
# Here we are selecting all players and iterating through them
# session.query() is specific to SQLAlchemy which is primarily used with flask as an ORM
players = session.query(Player).all()
for player in players:
# Set other form fields like a dynamically populated SelectField etc.
# Set the boolean field for each player here
form.is_active.default = "checked" if player.active == 1 else ""
我想要实现的是从此范围在class Predict(views.APIView):
def post(self, request):
employeeId = 44
return render(request, 'InventoryShop/home.html', {'employeeId': employeeId})
上输出此employeeId
。
但是,这段代码在尝试运行时给出了错误:
home.html
当我将此context must be a dict rather than set.
放在示波器之外时,我仍然可以毫无问题地输出它:
employeeId
编辑:我知道从1.8到1.11的更改