mirror of
https://github.com/jazzband/django-categories.git
synced 2026-03-16 22:30:24 +00:00
more Django 4.1 fixes
This commit is contained in:
parent
b66777ef70
commit
d24aab4d42
3 changed files with 6 additions and 4 deletions
|
|
@ -10,7 +10,7 @@ class Command(BaseCommand):
|
|||
help = "Alter the tables for all registered models, or just specified models"
|
||||
args = "[appname ...]"
|
||||
can_import_settings = True
|
||||
requires_system_checks = False
|
||||
requires_system_checks = []
|
||||
|
||||
def add_arguments(self, parser):
|
||||
"""Add app_names argument to the command."""
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class Command(BaseCommand):
|
|||
help = "Drop the given field from the given model's table"
|
||||
args = "appname modelname fieldname"
|
||||
can_import_settings = True
|
||||
requires_system_checks = False
|
||||
requires_system_checks = []
|
||||
|
||||
def add_arguments(self, parser):
|
||||
"""Add app_name, model_name, and field_name arguments to the command."""
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"""Adds and removes category relations on the database."""
|
||||
from django.apps import apps
|
||||
from django.db import DatabaseError, connection, transaction
|
||||
from django.db.utils import ProgrammingError
|
||||
from django.db.utils import OperationalError, ProgrammingError
|
||||
|
||||
|
||||
def table_exists(table_name):
|
||||
|
|
@ -71,7 +71,9 @@ def migrate_app(sender, *args, **kwargs):
|
|||
schema_editor.add_field(model, registry._field_registry[fld])
|
||||
if sid:
|
||||
transaction.savepoint_commit(sid)
|
||||
except ProgrammingError:
|
||||
# Django 4.1 with sqlite3 has for some reason started throwing OperationalError
|
||||
# instead of ProgrammingError, so we need to catch both.
|
||||
except (ProgrammingError, OperationalError):
|
||||
if sid:
|
||||
transaction.savepoint_rollback(sid)
|
||||
continue
|
||||
|
|
|
|||
Loading…
Reference in a new issue