当我在请求JSON ()中添加新的本地化(不是为游戏手动添加)以更新成绩或排行榜时,服务器返回以下错误:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "UnsupportedLocale",
"message": "The locale bg in the name field is not supported by the application."
这是一种在Player Django模型上更新反规范化字段的低效方法。该字段本质上存储了玩家在排行榜上的位置,这是我们用来向给定玩家显示“附近”玩家的系统所必需的。
for position, player in enumerate(Player.objects.order_by('-score')):
player.position = position + 1
player.save()
有没有办法在一个SQL查询中执行此更新?我们使用的数据库后端是MySQL。
耽误您时间,实在对不起!