Hotfix for #4501: Skipped many to many related objects autoupdate signal during migrations.

This commit is contained in:
Norman Jäckel 2019-03-13 10:58:01 +01:00
parent 6d66ec5b5d
commit baacda2b8e

View File

@ -1,3 +1,5 @@
import sys
from django.apps import apps from django.apps import apps
from django.contrib.auth.models import Permission from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
@ -49,6 +51,11 @@ def autoupdate_for_many_to_many_relations(sender, instance, **kwargs):
Send autoupdate for many-to-many related objects if the other side Send autoupdate for many-to-many related objects if the other side
is deleted. is deleted.
""" """
# Hotfix for #4501: Skip autoupdate for many-to-many related objects
# during migrations.
if "migrate" in sys.argv:
return
m2m_fields = ( m2m_fields = (
field field
for field in instance._meta.get_fields(include_hidden=True) for field in instance._meta.get_fields(include_hidden=True)