Use id__gte=..
argument. And use F()
query expression to update:
from django.db.models import F
Car.objects.filter(id__gte=id_parameter).update(F('field') + 1)
سؤال
Django
model views | How to Update objects from id_parameter to last, and increment 1 to value ?
def view_update():
car.objects.filter(from id to last).update(field=+1) # or delete
how i can do , "from id to last"?
thanks.
المحلول
Use id__gte=..
argument. And use F()
query expression to update:
from django.db.models import F
Car.objects.filter(id__gte=id_parameter).update(F('field') + 1)