Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#23 Improve django version check using pkg_resources #24

Merged
merged 1 commit into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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