routing.py
route("websocket.receive", im_active, path=r'^/(?P<slug>[^/]+)/stream/$'),
def im_active(message, slug):
post = json.loads(message['text'])['post']
current_user = VisitorInfo.objects.get(user_id=user)
current_user.active=True
current_user.save()
活动字段的值不会在后端更新。如果我再次在im_active
函数中获取活动值,例如:
new_user = VisitorInfo.objects.get(user_id=user)
print(new_user)
给出True
,但它不会在数据库中更新。