Skip to content
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
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
8 changes: 1 addition & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <http://django-formidable.readthedocs.io/en/latest/deprecations.html>`_ document for more information on deprecated versions.


License
=======

Expand Down
14 changes: 2 additions & 12 deletions demo/demo/urls.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -14,14 +13,5 @@
url(r'^preview/(?P<pk>\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'),
]
15 changes: 2 additions & 13 deletions demo/tests/test_app.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
12 changes: 4 additions & 8 deletions demo/tests/test_end_point.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import copy
from functools import reduce
from itertools import chain
from unittest import skipIf

from django.conf import settings
Expand Down Expand Up @@ -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()
Expand Down
13 changes: 9 additions & 4 deletions docs/source/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions formidable/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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
)
1 change: 0 additions & 1 deletion formidable/forms/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,4 @@ def __repr__(self):
return "<Condition {name}: Display {fields} if {tests}>".format(
fields=self.fields_ids,
tests=self.tests,
action=self.action,
name=self.name)
10 changes: 3 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,17 +13,13 @@ 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
drf310: djangorestframework<3.11
; 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 =
Expand Down Expand Up @@ -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
Expand Down