mysql - use F to update multiple fields Python -
hi need update multiple fields in database , right updating
t in getteamplayers : getmyplayer= myplayer.objects.get(id=t.playerid) getplayerage = getmyplayer.age increase = max(0, (1+((midage - getplayerage) * multiplier) / 100) * 0.05 / 9) getvitals = vitals.objects.get(playerid=t.playerid) getvitals.velocity = min(max(getvitals.velocity + increase,0),1) getvitals.power = min(max(getvitals.power + increase,0),1) getvitals.arm = min(max(getvitals.arm + increase,0),1) getvitals.ranges = min(max(getvitals.ranges + increase,0),1) #getvitals.save() vitals.objects.update()
but takes time want use myplayer.objects.update(age=f('age')+0.0192)
uses f , updates can please suggest me how can use f update multiple fields in in above code can update fields fast thanks
Comments
Post a Comment