'''

Decide on a JSONField implementation based on available packages.

There are two possible options, preferred in the following order:
  - JSONField from django-jsonfield with django-jsonfield-compat
  - JSONField from django-mysql (needs MySQL 5.7+)

Raises an ImportError if USE_JSONFIELD is True but none of these are
installed.

Falls back to a simple Django TextField if USE_JSONFIELD is False,
however that field will be removed by migration 0002 directly
afterwards.

'''
import django
from django.db import models
from django.core.exceptions import ImproperlyConfigured

from actstream.settings import USE_JSONFIELD


__all__ = ('DataField', )


DataField = models.TextField

if USE_JSONFIELD:
    if django.VERSION >= (3, 1):
        from django.db.models import JSONField
        DataField = JSONField
    else:
        try:
            from django_jsonfield_backport.models import JSONField
            DataField = JSONField
        except ImportError:
            raise ImproperlyConfigured(
                'You must install django-jsonfield-backport, '
                'if you wish to use a JSONField on your actions '
                'and run Django < 3.1'
            )

@@ -72,186 +72,195 @@
 %0AThe
-r
+s
 e are t
-wo possible options, preferred in the following order:%0A  - JSONField from django-jsonfield with django-jsonfield-compat%0A  - JSONField from django-mysql (needs MySQL 5.7+)
+he options:%0A  - With recent Django %3E= 3.1 use Django's builtin JSONField.%0A  - For Django versions %3C 3.1 we need django-jsonfield-backport%0A      and will use its JSONField instead.
 %0A%0ARa
@@ -303,16 +303,17 @@
  is True
+,
  but non
@@ -324,24 +324,21 @@
  the
-se are%0Ainstalled
+ above %0Aapply
 .%0A%0AF

Remove mysql details from docstring (#511)