Skip to content

Commit

Permalink
bhch#23 Improve django version check using pkg_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Rogulski committed Jan 31, 2022
1 parent 4caf7e0 commit e3f4a48
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion django_jsonform/forms/fields.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import json
import pkg_resources
import django
from django.db import models
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured

if django.VERSION[0] >= 3 and django.VERSION[1] >= 1:
if pkg_resources.parse_version(django.get_version()) >= pkg_resources.parse_version("3.1"):
# Django >= 3.1
from django.forms import JSONField as DjangoJSONFormField
else:
Expand Down
3 changes: 2 additions & 1 deletion django_jsonform/models/fields.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import pkg_resources
import django
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured

if django.VERSION[0] >= 3 and django.VERSION[1] >= 1:
if pkg_resources.parse_version(django.get_version()) >= pkg_resources.parse_version("3.1"):
# Django >= 3.1
from django.db.models import JSONField as DjangoJSONField
else:
Expand Down

0 comments on commit e3f4a48

Please sign in to comment.