From 8f3b7e1a00c0f68652bfc2fecc6c3bfecb3b9af4 Mon Sep 17 00:00:00 2001 From: Bruno Bord Date: Wed, 17 Jun 2020 09:18:26 +0200 Subject: [PATCH 1/2] Unrelated: new flake version, small fixes in tests and runtime --- demo/tests/test_end_point.py | 12 ++++-------- formidable/forms/conditions.py | 1 - 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/demo/tests/test_end_point.py b/demo/tests/test_end_point.py index b2713217..a391d197 100644 --- a/demo/tests/test_end_point.py +++ b/demo/tests/test_end_point.py @@ -1,5 +1,5 @@ import copy -from functools import reduce +from itertools import chain from unittest import skipIf from django.conf import settings @@ -1026,17 +1026,13 @@ def test_create_field(self): def test_create_ordering(self): # aggregate fields - def extend(l, elt): - l.extend(elt) - return l - - fields = reduce(extend, [ + fields_aggregated = list(chain( self.fields_with_items, self.fields_without_items, self.format_field_helptext, self.format_field_separator, self.format_field_title - ], []) + )) data = copy.deepcopy(self.data) - data['fields'] = fields + data['fields'] = fields_aggregated serializer = FormidableSerializer(data=data) self.assertTrue(serializer.is_valid()) form = serializer.save() diff --git a/formidable/forms/conditions.py b/formidable/forms/conditions.py index e6927eb1..7d620581 100644 --- a/formidable/forms/conditions.py +++ b/formidable/forms/conditions.py @@ -175,5 +175,4 @@ def __repr__(self): return "".format( fields=self.fields_ids, tests=self.tests, - action=self.action, name=self.name) From 6c48b8e668a5e5d9ec0529e8b3a2a63460c5b03b Mon Sep 17 00:00:00 2001 From: Bruno Bord Date: Wed, 17 Jun 2020 09:57:25 +0200 Subject: [PATCH 2/2] Drop support for Django 1.11 refs #398 --- CHANGELOG.rst | 2 +- README.rst | 8 +------- demo/demo/urls.py | 14 ++------------ demo/tests/test_app.py | 15 ++------------- docs/source/deprecations.rst | 13 +++++++++---- formidable/app.py | 12 ------------ tox.ini | 10 +++------- 7 files changed, 18 insertions(+), 56 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 95d6b2ac..0d7946ab 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,8 +5,8 @@ ChangeLog master (unreleased) =================== +- Drop support for Django 1.11 (#398, #395). - Drop support for Django REST Framework 3.8 (#382). -- Ensure ``jsonfield`` compatibility check. Documentation is amended, and an ``ImportWarning`` is thrown as soon as you're using Django 1.11 (#395). - Fix Postgresql configuration in CircleCI regarding the authentication (#395). - Small cleanups of Python2-related code. diff --git a/README.rst b/README.rst index 7bff49bf..66ed309b 100644 --- a/README.rst +++ b/README.rst @@ -14,17 +14,11 @@ Warnings ======== * Python Compatibility : 3.5, 3.6, 3.7, 3.8 -* Django compatibility : Django 1.11, 2.2. +* Django compatibility : Django 2.2. * Django REST Framework : Compatible from the version 3.9.x to 3.10.x -.. warning:: - - Versions of ``jsonfield`` beyond 3.x are incompatible with Django 1.11. - If you're still using Django 1.11, you'll have to freeze it with ``jsonfield<3`` in your project. - See the `Deprecation timeline `_ document for more information on deprecated versions. - License ======= diff --git a/demo/demo/urls.py b/demo/demo/urls.py index fd0b1cc5..79348afa 100644 --- a/demo/demo/urls.py +++ b/demo/demo/urls.py @@ -1,7 +1,6 @@ -from distutils.version import StrictVersion as version -import django from django.conf.urls import include, url from django.contrib import admin +from django.urls import path from demo.views import FormPreview, DemoValidateViewFromSchema @@ -14,14 +13,5 @@ url(r'^preview/(?P\d+)/', FormPreview.as_view()), url(r'^forms/', include(('demo.builder.urls', 'builder'), namespace='builder')), + path(r'admin/', admin.site.urls, 'admin'), ] - -if version(django.get_version()) < version("2.0"): - urlpatterns += [ - url(r'^admin/', include(admin.site.urls)), - ] -else: - from django.urls import path # noqa - urlpatterns += [ - path(r'admin/', admin.site.urls, 'admin'), - ] diff --git a/demo/tests/test_app.py b/demo/tests/test_app.py index a45939b7..123b79ec 100644 --- a/demo/tests/test_app.py +++ b/demo/tests/test_app.py @@ -1,8 +1,5 @@ import warnings -from distutils.version import StrictVersion as version - -import django from django.apps import apps from django.test import TestCase @@ -15,13 +12,5 @@ def test_apps(self): warnings.simplefilter("always") # Trigger a warning. config.ready() - # Verify some things - if version(django.get_version()) < version("2.0"): - # Django 1.11 mainly - assert len(w) == 1, w - test_warning = w[0] - assert issubclass(test_warning.category, ImportWarning) - assert "jsonfield" in str(test_warning.message) - else: - # No warning beyond Django 2. - assert len(w) == 0, w + # Verify there's no warning. + assert len(w) == 0, w diff --git a/docs/source/deprecations.rst b/docs/source/deprecations.rst index 4cbdc038..35a47aa7 100644 --- a/docs/source/deprecations.rst +++ b/docs/source/deprecations.rst @@ -5,14 +5,19 @@ Deprecation timeline From 4.0.1 to x.y.z =================== +Django versions +--------------- + .. deprecated:: x.y.z - Drop support for Django Rest Framework 3.8 + Drop support for Django 1.11 -.. warning:: x.y.z +Django REST Framework versions +------------------------------ + +.. deprecated:: x.y.z - As of February 2020, several releases of the library ``jsonfield`` have broken the compatibility with Django 1.11. - As a consequence, if you want to use Django Formidable with Django 1.11, you'll have to make sure that you're freezing your requirements to ``jsonfield<3``. + Drop support for Django Rest Framework 3.8 From 3.3.0 to 4.0.0 diff --git a/formidable/app.py b/formidable/app.py index 310dc3bb..2eec3294 100644 --- a/formidable/app.py +++ b/formidable/app.py @@ -5,10 +5,6 @@ * post-update and post-create callbacks """ -import warnings -from distutils.version import StrictVersion as version - -import django from django.apps import AppConfig @@ -24,11 +20,3 @@ def ready(self): """ from .views import check_callback_configuration check_callback_configuration() - # Incompatibility between some version of jsonfield + Django. - if version(django.get_version()) < version("2.0"): - warnings.warn( - "If you're using Django<2.0, you must pin jsonfield version in" - " your requirements to ``jsonfield<3``. See deprecation" - " documentation for more details", - ImportWarning - ) diff --git a/tox.ini b/tox.ini index f1150fbf..b7188ffb 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,5 @@ [tox] envlist = - django111-py{35,36,37,38}-drf{39,310}-{sqlite,pg} django22-py{35,36,37,38}-drf{39,310}-{sqlite,pg} spectest flake8 @@ -14,7 +13,6 @@ usedevelop = True changedir = demo deps = ; Django versions - django111: Django>=1.11,<1.12 django22: Django>=2.2,<2.3 ; DRF versions drf39: djangorestframework<3.10 @@ -22,9 +20,6 @@ deps = ; When testing with postgresql pg: psycopg2-binary - ; jsonfield compatibility with Django 1.11 - django111: jsonfield<3 - ; Requirements from demo project -rdemo/requirements-demo.pip commands = @@ -77,9 +72,10 @@ commands = ; Not included in the test env run with `tox` [testenv:docs] +basepython = python3 deps = - ; doc building is using the latest LTS version to date (april 2018) - Django>=1.11,<1.12 + ; doc building is using the latest LTS version to date (june 2020) + Django>=2.2,<2.3 -rdocs/requirements.pip whitelist_externals = make changedir = docs