Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2005 from loic/ticket21169

Use 'update_fields' in RelatedManager.clear() when bulk=False.
  • Loading branch information...
commit 936dbaf12812218726deac6803865148686adbd1 2 parents 34b8a38 + 91fce67
Anssi Kääriäinen akaariai authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  django/db/models/fields/related.py
2  django/db/models/fields/related.py
View
@@ -492,7 +492,7 @@ def _clear(self, queryset, bulk):
with transaction.commit_on_success_unless_managed(using=db, savepoint=False):
for obj in queryset:
setattr(obj, rel_field.name, None)
- obj.save()
+ obj.save(update_fields=[rel_field.name])
_clear.alters_data = True
return RelatedManager
Please sign in to comment.
Something went wrong with that request. Please try again.