python - How to modify a model after bulk update in django? -
i try code this:
mymodels = mymodel.objects.filter(status=1) mymodels.update(status=4) print(mymodels)
and result empty list
i know can use loop replace update.
but makes lot of update query.
is there anyway continue manipulate mymodels after bulk update?
mymodels = mymodel.objects.filter(status=1) objs = [obj obj in mymodels] # save objects update mymodels.update(status=4) print(objs)
should work.
explanations why had been given timmy o'mahony.
Comments
Post a Comment