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
Post a Comment