Skip to content

Commit 45a9dde

Browse files
committed
Adjust makemigrations command to take advantage of autodetector class.
Per django/django@06bf06a fix #49.
1 parent 024fb70 commit 45a9dde

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

syzygy/management/commands/makemigrations.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ class StyledMigrationAutodetector(MigrationAutodetector):
2727
def __init__(self, *args, **kwargs):
2828
super().__init__(*args, **kwargs, style=style)
2929

30-
makemigrations.MigrationAutodetector = StyledMigrationAutodetector
30+
if hasattr(self, "autodetector"):
31+
self.autodetector = StyledMigrationAutodetector
32+
else:
33+
makemigrations.MigrationAutodetector = StyledMigrationAutodetector
3134
try:
3235
super().handle(*args, **options)
3336
finally:
34-
makemigrations.MigrationAutodetector = MigrationAutodetector_
37+
if not hasattr(self, "autodetector"):
38+
makemigrations.MigrationAutodetector = MigrationAutodetector_

0 commit comments

Comments
 (0)