More on Django 3.0 compat

This commit is contained in:
Artur Barseghyan 2020-01-10 23:28:31 +01:00
parent 56db68cac4
commit 0b41cff8a6
12 changed files with 70 additions and 134 deletions

View file

@ -15,6 +15,14 @@ are used for versioning (schema follows below):
0.3.4 to 0.4).
- All backwards incompatible changes are mentioned in this document.
0.16
----
2020-01-xx (not yet released)
- Drop support Django 1.8, 1.9, 1.10. Minimal supported Django version is 1.11.
- Add support for Django 3.0.
- Drop Python 3.4 support.
0.15
----
2019-06-20

View file

@ -22,8 +22,8 @@ handling the submitted form data).
Prerequisites
=============
- Django 1.8, 1.9, 1.10, 1.11, 2.0, 2.1 and 2.2.
- Python 2.7, 3.4, 3.5, 3.6 and 3.7.
- Django 1.11, 2.0, 2.1, 2.2 and 3.0.
- Python 2.7, 3.5, 3.6, 3.7 and 3.8.
Key concepts
============

View file

@ -68,7 +68,7 @@ except Exception as e:
# 'south', # Database migration app
# 'tinymce', # TinyMCE
'easy_thumbnails', # Thumbnailer
'registration', # Auth views and registration app
'django_registration', # Auth views and registration app
# 'localeurl', # Locale URL
# *****************************************************************

View file

@ -0,0 +1,16 @@
-r common.txt
-r test.txt
-r style_checkers.txt
-r feincms_1_17.txt
Django>=3.0,<3.1
django-admin-tools>=0.8.0
django-autoslug>=1.9.6
django-ckeditor>=5.8.0
django-debug-toolbar>=2.1
django-formtools>=2.2
#django-registration>=3.0.1
https://github.com/ubernostrum/django-registration/archive/master.zip
django-simple-captcha>=0.5.12
djangorestframework>=3.10
easy-thumbnails>=2.7.0

View file

@ -0,0 +1,5 @@
#-r django_1_11.txt
FeinCMS==1.17.0
django-mptt==0.9.0
#django-tinymce==2.6.0

View file

@ -1,6 +1,6 @@
from captcha.fields import CaptchaField
from registration.forms import RegistrationForm
from django_registration.forms import RegistrationForm
class CaptchaRegistrationForm(RegistrationForm):

View file

@ -230,7 +230,7 @@ INSTALLED_APPS = [
# Third party apps used in the project
# 'tinymce', # TinyMCE
'easy_thumbnails', # Thumbnailer
'registration', # Auth views and registration app
'django_registration', # Auth views and registration app
'captcha',
'ckeditor',
'fobi.reusable.markdown_widget',

View file

@ -61,7 +61,7 @@ else:
url_patterns_args += [
# django-registration URLs:
url(r'^accounts/', include('registration.backends.simple.urls')),
url(r'^accounts/', include('django_registration.backends.one_step.urls')),
# foo URLs:
url(r'^foo/', include('foo.urls')),

View file

@ -157,7 +157,7 @@ INSTALLED_APPS = (
# Third party apps used in the project
'tinymce', # TinyMCE
'easy_thumbnails', # Thumbnailer
'registration', # Auth views and registration app
'django_registration', # Auth views and registration app
# Fobi core
'fobi',

View file

@ -36,7 +36,7 @@ urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
# django-registration URLs:
url(r'^accounts/', include('registration.backends.default.urls')),
url(r'^accounts/', include('django_registration.backends.one_step.urls')),
# foo URLs:
url(r'^foo/', include('foo.urls')),

156
setup.py
View file

@ -4,14 +4,13 @@ import sys
from distutils.version import LooseVersion
from setuptools import setup, find_packages
version = '0.15'
version = '0.16'
# ***************************************************************************
# ************************** Python version *********************************
# ***************************************************************************
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
LTE_PY26 = PY2 and (7 > sys.version_info[1])
PYPY = hasattr(sys, 'pypy_translation_info')
# ***************************************************************************
@ -29,8 +28,18 @@ try:
# Loose versions
LOOSE_VERSIONS = (
'1.4', '1.5', '1.6', '1.7', '1.8', '1.9', '1.10', '1.11', '2.0', '2.1',
'2.2', '3.0'
'1.4',
'1.5',
'1.6',
'1.7',
'1.8',
'1.9',
'1.10',
'1.11',
'2.0',
'2.1',
'2.2',
'3.0',
)
for v in LOOSE_VERSIONS:
@ -229,98 +238,22 @@ for locale_dir in locale_dirs:
dependency_links = []
install_requires = []
# If certain version of Django is already installed, choose version agnostic
# dependencies.
if DJANGO_INSTALLED:
if DJANGO_1_8:
install_requires = [
'bleach',
'django-autoslug==1.9.4',
'django-formtools>=1.0',
'django-nine>=0.2.2',
'django-nonefield>=0.1',
'Pillow>=2.0.0',
'requests>=1.0.0',
'six>=1.9',
'Unidecode>=0.04.1',
'vishap>=0.1.5,<2.0',
]
elif DJANGO_1_9:
install_requires = [
'bleach',
'django-autoslug==1.9.4',
'django-formtools>=1.0',
'django-nine>=0.2.2',
'django-nonefield>=0.1',
'Pillow>=2.0.0',
'requests>=1.0.0',
'six>=1.9',
'Unidecode>=0.04.1',
'vishap>=0.1.5,<2.0',
]
elif DJANGO_1_10:
install_requires = [
'bleach',
'django-autoslug==1.9.4',
'django-formtools>=1.0',
'django-nine>=0.2.2',
'django-nonefield>=0.1',
'Pillow>=2.0.0',
'requests>=1.0.0',
'six>=1.9',
'Unidecode>=0.04.1',
'vishap>=0.1.5,<2.0',
]
elif DJANGO_1_11:
install_requires = [
'bleach',
'django-autoslug==1.9.4',
'django-formtools>=2.0',
'django-nine>=0.2.2',
'django-nonefield>=0.1',
'Pillow>=2.0.0',
'requests>=1.0.0',
'six>=1.9',
'Unidecode>=0.04.1',
'vishap>=0.1.5,<2.0',
]
# dependency_links.append(
# 'https://github.com/django/django-formtools/archive/master.tar.gz'
# '#egg=django-formtools'
# )
elif DJANGO_2_0:
install_requires = [
'bleach',
'django-autoslug==1.9.4',
'django-formtools>=2.0',
'django-nine>=0.2.2',
'django-nonefield>=0.3',
'Pillow>=2.0.0',
'requests>=1.0.0',
'six>=1.9',
'Unidecode>=0.04.1',
'vishap>=0.1.5,<2.0',
]
# dependency_links.append(
# 'https://github.com/django/django-formtools/archive/master.tar.gz'
# '#egg=django-formtools'
# )
# Fall back to the latest dependencies
if not install_requires:
install_requires = [
'bleach',
'django-autoslug>=1.9.4',
'django-formtools>=2.0',
'django-nine>=0.2.2',
'django-nonefield>=0.1',
'Pillow>=2.0.0',
'requests>=1.0.0',
'six>=1.9',
'Unidecode>=0.04.1',
'vishap>=0.1.5,<2.0',
]
# Dependencies
install_requires = [
'bleach',
'django-autoslug>=1.9.4',
'django-formtools>=2.0',
'django-nine>=0.2.2',
'django-nonefield>=0.1',
'Pillow>=2.0.0',
'requests>=1.0.0',
'six>=1.9',
'Unidecode>=0.04.1',
'vishap>=0.1.5,<2.0',
'easy-thumbnails>=2.4.1',
'simplejson>=3.0.0;python_version>"3.4"',
'simplejson>=2.1.0,<=3.8.0;python_version<"3"',
]
# There are also conditional PY3/PY2 requirements. Scroll down to see them.
@ -336,33 +269,6 @@ tests_require = [
# 'tox',
]
if PY3:
install_requires.append('simplejson>=3.0.0,<=3.8.0') # When using Python3
if DJANGO_INSTALLED and not DJANGO_1_11:
install_requires.append('easy-thumbnails>=2.3')
else:
install_requires.append('easy-thumbnails>=2.4.1')
# dependency_links.append(
# 'https://github.com/SmileyChris/easy-thumbnails/archive/'
# 'master.tar.gz'
# '#egg=easy-thumbnails'
# )
else:
install_requires.append('simplejson>=2.1.0,<=3.8.0') # When using Python2
install_requires.append('ordereddict>=1.1')
if DJANGO_INSTALLED and not DJANGO_1_11:
install_requires.append('easy-thumbnails>=1.4')
else:
install_requires.append('easy-thumbnails>=2.4.1')
# dependency_links.append(
# 'https://github.com/SmileyChris/easy-thumbnails/archive/'
# 'master.tar.gz'
# '#egg=easy-thumbnails'
# )
# if PYPY:
# install_requires.remove('Pillow>=2.0.0')
setup(
name='django-fobi',
version=version,
@ -372,10 +278,10 @@ setup(
classifiers=[
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Environment :: Web Environment",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"License :: OSI Approved :: GNU Lesser General Public License v2 or "
@ -392,7 +298,7 @@ setup(
url='https://github.com/barseghyanartur/django-fobi/',
package_dir={'': 'src'},
packages=find_packages(where='./src'),
license='GPL 2.0/LGPL 2.1',
license='GPL-2.0-only OR LGPL-2.1-or-later',
install_requires=install_requires,
tests_require=tests_require,
dependency_links=dependency_links,

View file

@ -8,7 +8,8 @@ from django.forms import formsets, ValidationError
from django.views.generic import TemplateView
from django.utils.decorators import classonlymethod
from django.utils.translation import ugettext as _
from django.utils import six
import six
from django_nine import versions