[Django]-Django queryset update field increasing/descreasing its current value

40👍

You want to use F() objects.

from django.db.models import F
Objtree.objects.filter(pk__in=ids).update(sort_order=F('sort_order')+1)

See the documentation

Leave a comment