diff --git a/actstream/apps.py b/actstream/apps.py index 2fb053bc..edb2d612 100644 --- a/actstream/apps.py +++ b/actstream/apps.py @@ -25,14 +25,3 @@ def ready(self): DataField(blank=True, null=True).contribute_to_class( action_class, 'data' ) - - # dynamically load django_jsonfield_backport to INSTALLED_APPS - if django.VERSION < (3, 1) and 'django_jsonfield_backport' not in settings.INSTALLED_APPS: - settings.INSTALLED_APPS += ('django_jsonfield_backport', ) - # reset loaded apps - apps.app_configs = OrderedDict() - # reset initialization status - apps.apps_ready = apps.models_ready = apps.loading = apps.ready = False - apps.clear_cache() - # re-initialize all apps - apps.populate(settings.INSTALLED_APPS) diff --git a/actstream/jsonfield.py b/actstream/jsonfield.py index 79f3ec17..231ba60d 100644 --- a/actstream/jsonfield.py +++ b/actstream/jsonfield.py @@ -1,23 +1,12 @@ ''' -Decide on a JSONField implementation based on available packages. - -These are the options: - - With recent Django >= 3.1 use Django's builtin JSONField. - - For Django versions < 3.1 we need django-jsonfield-backport - and will use its JSONField instead. - -Raises an ImportError if USE_JSONFIELD is True, but none of the above -apply. - -Falls back to a simple Django TextField if USE_JSONFIELD is False, -however that field will be removed by migration 0002 directly -afterwards. +django-activity-stream offered support for an optional JSON data field from 0.4.4 up until 1.4.0. +This was accomplished by overloading DataField with different model field types. +As of Django 3.2, the JSONField is supported by default. +However we need to keep this mapping to not break migrations. ''' -import django -from django.db import models -from django.core.exceptions import ImproperlyConfigured +from django.db.models import JSONField from actstream.settings import USE_JSONFIELD @@ -25,19 +14,4 @@ __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' - ) +DataField = JSONField diff --git a/docs/changelog.rst b/docs/changelog.rst index ec1ecdea..6c366855 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -3,6 +3,12 @@ Changelog ========= +Unreleased +---------- + +- BREAKING: Drop support for EOL versions of Django (< 3.2) +- Remove JSONField compatibility, extras and autoloading + 1.4.0 ------ diff --git a/docs/data.rst b/docs/data.rst index 82adb742..d5a17bf1 100644 --- a/docs/data.rst +++ b/docs/data.rst @@ -11,13 +11,6 @@ This uses a ``data`` JSONField on every Action where you can insert and delete v This behavior is disabled by default but just set ``ACTSTREAM_SETTINGS['USE_JSONFIELD'] = True`` in your settings.py to enable it. -.. note:: - - If you're running Django < 3.1 you must install django-jsonfield-backport or the extra ``jsonfield`` of this package. - "django_jsonfield_backport" gets dynamically added to the INSTALLED_APPS of your Django application if not yet done manually. - - Please make sure to remove both the django-jsonfield-backport package and the ``django_jsonfield_backport`` INSTALLED_APPS entry (if manually added) after upgrading to Django >= 3.1 - You can send the custom data as extra keyword arguments to the ``action`` signal. .. code-block:: python @@ -49,12 +42,6 @@ Adding to Existing Project If you start out your project with ``USE_JSONFIELD=False``, dont worry you can add it afterwards. -Make sure you have the latest JSONField implementation - -.. code-block:: - - pip install django-activity-stream[jsonfield] - Make sure ``USE_JSONFIELD`` is non-existent or set to False then do the initial migration .. code-block:: bash diff --git a/docs/installation.rst b/docs/installation.rst index 28d5c6f2..9d49af7d 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -46,20 +46,6 @@ Add the activity urls to your urlconf The activity urls are not required for basic usage but provide activity :ref:`feeds` and handle following, unfollowing and querying of followers. - -Add extra data to actions -------------------------- - -If you want to use custom data on your actions and are running Django < 3.1, then make sure you have -`django-jsonfield-backport `_ installed. - -.. code-block:: bash - - $ pip install django-activity-stream[jsonfield] - -You can learn more at :ref:`custom-data` - - Supported Environments ---------------------- @@ -74,14 +60,13 @@ Make sure to pick the version of Django and django-activity-stream that supports Python ****** - * **Python 3**: 3.6 to 3.9 * **PyPy**: 3 Django ****** -* **Django**: 2.2+ only +* **Django**: 3.2+ only Databases ********* diff --git a/runtests/requirements.txt b/runtests/requirements.txt index 363b4c4f..8c4a038d 100644 --- a/runtests/requirements.txt +++ b/runtests/requirements.txt @@ -1,3 +1,2 @@ -Django>=2.2.17 -django-jsonfield-backport +Django>=3.2 tblib diff --git a/setup.py b/setup.py index 0a26ad0d..48f9c9e6 100644 --- a/setup.py +++ b/setup.py @@ -13,6 +13,7 @@ license='BSD 3-Clause', author_email='justquick@gmail.com', url='http://github.com/justquick/django-activity-stream', + install_requires=['Django>=3.2'], packages=['actstream', 'actstream.migrations', 'actstream.templatetags', @@ -29,7 +30,4 @@ 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Topic :: Utilities'], - extras_require={ - 'jsonfield': ['django-jsonfield-backport>=1.0.2,<2.0'], - }, )