Merge pull request #2005 from loic/ticket21169

Use 'update_fields' in RelatedManager.clear() when bulk=False.
This commit is contained in:
Anssi Kääriäinen 2013-11-28 12:04:21 -08:00
commit 936dbaf128
1 changed files with 1 additions and 1 deletions

View File

@ -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