def update_list_best_practice():
"""
Hits the DB once no matter how many objects.
NB:
- save() will not be called, and the related signals will not be sent.
- does not work with m2m relationships.
>>> UPDATE community SET name = (community.name + ' e.V')
WHERE community.name LIKE 'community%'
"""
communities = Community.objects.filter(name__startswith='community')
communities.update(name=Concat('name', Value(' e.V')))
## Bulk delete
##############
评论列表
文章目录