summaryrefslogtreecommitdiff
path: root/django/db/migrations/autodetector.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/migrations/autodetector.py')
-rw-r--r--django/db/migrations/autodetector.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py
index e79e745978..ece58b9bab 100644
--- a/django/db/migrations/autodetector.py
+++ b/django/db/migrations/autodetector.py
@@ -1,6 +1,5 @@
import functools
import re
-from contextlib import suppress
from itertools import chain
from django.conf import settings
@@ -435,7 +434,7 @@ class MigrationAutodetector:
Place potential swappable models first in lists of created models (only
real way to solve #22783).
"""
- with suppress(LookupError):
+ try:
model = self.new_apps.get_model(item[0], item[1])
base_names = [base.__name__ for base in model.__bases__]
string_version = "%s.%s" % (item[0], item[1])
@@ -446,6 +445,8 @@ class MigrationAutodetector:
settings.AUTH_USER_MODEL.lower() == string_version.lower()
):
return ("___" + item[0], "___" + item[1])
+ except LookupError:
+ pass
return item
def generate_renamed_models(self):