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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -