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

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -