mirror of https://github.com/django/django.git
Merge pull request #2005 from loic/ticket21169
Use 'update_fields' in RelatedManager.clear() when bulk=False.
This commit is contained in:
commit
936dbaf128
|
@ -492,7 +492,7 @@ def create_foreign_related_manager(superclass, rel_field, rel_model):
|
||||||
with transaction.commit_on_success_unless_managed(using=db, savepoint=False):
|
with transaction.commit_on_success_unless_managed(using=db, savepoint=False):
|
||||||
for obj in queryset:
|
for obj in queryset:
|
||||||
setattr(obj, rel_field.name, None)
|
setattr(obj, rel_field.name, None)
|
||||||
obj.save()
|
obj.save(update_fields=[rel_field.name])
|
||||||
_clear.alters_data = True
|
_clear.alters_data = True
|
||||||
|
|
||||||
return RelatedManager
|
return RelatedManager
|
||||||
|
|
Loading…
Reference in New Issue