Skip to content

Commit

Permalink
Remove backwards compatible try/excepts
Browse files Browse the repository at this point in the history
  • Loading branch information
browniebroke committed Aug 14, 2023
1 parent a44388f commit 4e76f8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
11 changes: 2 additions & 9 deletions modeltrans/fields.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.core.exceptions import ImproperlyConfigured
from django.db.models import F, fields
from django.db.models import F, fields, JSONField
from django.db.models.fields.json import KeyTextTransform
from django.db.models.functions import Cast, Coalesce
from django.utils.translation import gettext

Expand All @@ -11,14 +12,6 @@
get_language,
)

try:
# django==3.1 moved JSONField into django.db.models
from django.db.models import JSONField
from django.db.models.fields.json import KeyTextTransform
except ImportError:
from django.contrib.postgres.fields import JSONField
from django.contrib.postgres.fields.jsonb import KeyTextTransform


SUPPORTED_FIELDS = (fields.CharField, fields.TextField)

Expand Down
6 changes: 1 addition & 5 deletions modeltrans/utils.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
from django.core.exceptions import FieldDoesNotExist
from django.db.models.constants import LOOKUP_SEP
from django.db.models.fields.json import KeyTransform
from django.db.models.lookups import Transform
from django.utils.translation import get_language as _get_language

from .conf import get_available_languages, get_default_language

try:
from django.db.models.fields.json import KeyTransform
except ImportError:
from django.contrib.postgres.fields.jsonb import KeyTransform


def get_language():
"""
Expand Down

0 comments on commit 4e76f8b

Please sign in to comment.