python - Django: change the value of a field for all objects in a queryset -


i have model mymodel boolean field active

elsewhere, retrieving queryset:

qs = mymodel.objects.filter(....)  

how can set active=false objects in qs?

you can update records in queryset with

qs.update(active=false) 

please refer official django documentation more info


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -