Skip to content

Commit

Permalink
Fix OperationalError under Django 5+
Browse files Browse the repository at this point in the history
In earlier versions it would raise ProgrammingError.
  • Loading branch information
julianwachholz committed Jun 26, 2024
1 parent e4a2b8a commit 49d157b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions example/app/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.contrib.auth import get_user_model
from django.db.utils import ProgrammingError
from django.db.utils import OperationalError, ProgrammingError


def disable_admin_login():
Expand All @@ -21,7 +21,7 @@ def disable_admin_login():
is_staff=True,
),
)
except ProgrammingError:
except (ProgrammingError, OperationalError):
# auth_user doesn't exist, this allows the migrations to run properly.
user = None

Expand Down

0 comments on commit 49d157b

Please sign in to comment.