开发者

Django: updating a field with a progressive number within an ordered queryset

开发者 https://www.devze.com 2023-02-15 10:46 出处:网络
Using Django 1.2.3, I need to u开发者_运维知识库pdate a model field with a ranking among an ordered set of instances, without having to retrieve the entire queryset and update each model by hand.

Using Django 1.2.3, I need to u开发者_运维知识库pdate a model field with a ranking among an ordered set of instances, without having to retrieve the entire queryset and update each model by hand.

Is there a way to achieve that?


I think this is what you need: http://docs.djangoproject.com/en/dev/topics/db/queries/#updating-multiple-objects-at-once

0

精彩评论

暂无评论...
验证码 换一张
取 消