[PATCH 04/11] Remove support for Django 1.8, 1.9, 1.10

Daniel Axtens dja at axtens.net
Sat Aug 11 03:57:51 AEST 2018


Stephen Finucane <stephen at that.guru> writes:

> These are now all EOL and Debian Testing supports Django 1.11 (LTS). We
> can and should drop them.
>
> This change does not remove the many compat wrappers. These will be
> removed separately (there are a lot of them).
>
> This leaves 1.11 as the only supported version. This will be remedied
> shortly with the inclusion of Django 2.0 support.


FYI, this doesn't cleanly apply to master any more, but can be applied
to v2.1.0 and then trivially rebased. No action required unless you're
doing another spin for some other reason.

Regards,
Daniel

>
> Signed-off-by: Stephen Finucane <stephen at that.guru>
> ---
>  README.rst                                    |  4 ++--
>  .../migrations/0021_django_1_10_fixes.py      | 13 ++++++-------
>  patchwork/models.py                           |  8 +-------
>  patchwork/settings/base.py                    | 17 +++++------------
>  patchwork/settings/dev.py                     | 19 ++++++-------------
>  patchwork/settings/production.example.py      |  8 ++++----
>  requirements-dev.txt                          |  2 +-
>  requirements-prod.txt                         |  2 +-
>  tox.ini                                       | 10 ++--------
>  9 files changed, 28 insertions(+), 55 deletions(-)
>
> diff --git a/README.rst b/README.rst
> index 94ac32c3..062166e9 100644
> --- a/README.rst
> +++ b/README.rst
> @@ -43,9 +43,9 @@ Requirements
>  
>  - Python (2.7, 3.4 - 3.6)
>  
> -- Django (1.8 - 1.11)
> +- Django (1.11 - 2.0)
>  
> -- Django REST Framework (3.4 - 3.8)
> +- Django REST Framework (3.6 - 3.8)
>  
>  - Django Filters (1.0 - 1.1)
>  
> diff --git a/patchwork/migrations/0021_django_1_10_fixes.py b/patchwork/migrations/0021_django_1_10_fixes.py
> index 55aedbec..ff1d8875 100644
> --- a/patchwork/migrations/0021_django_1_10_fixes.py
> +++ b/patchwork/migrations/0021_django_1_10_fixes.py
> @@ -18,10 +18,9 @@ class Migration(migrations.Migration):
>          ),
>      ]
>  
> -    if django.VERSION >= (1, 10):
> -        operations += [
> -            migrations.AlterModelOptions(
> -                name='patch',
> -                options={'base_manager_name': 'objects', 'verbose_name_plural': 'Patches'},
> -            ),
> -        ]
> +    operations += [
> +        migrations.AlterModelOptions(
> +            name='patch',
> +            options={'base_manager_name': 'objects', 'verbose_name_plural': 'Patches'},
> +        ),
> +    ]
> diff --git a/patchwork/models.py b/patchwork/models.py
> index 6268f5b7..71a07c94 100644
> --- a/patchwork/models.py
> +++ b/patchwork/models.py
> @@ -26,7 +26,6 @@ import datetime
>  import random
>  import re
>  
> -import django
>  from django.conf import settings
>  from django.contrib.auth.models import User
>  from django.core.exceptions import ValidationError
> @@ -309,10 +308,6 @@ class PatchQuerySet(models.query.QuerySet):
>  
>  
>  class PatchManager(models.Manager):
> -    use_for_related_fields = True
> -    # NOTE(stephenfin): This is necessary to silence a warning with Django >=
> -    # 1.10. Remove when 1.10 is the minimum supported version.
> -    silence_use_for_related_fields_deprecation = True
>  
>      def get_queryset(self):
>          return PatchQuerySet(self.model, using=self.db)
> @@ -595,8 +590,7 @@ class Patch(SeriesMixin, Submission):
>  
>      class Meta:
>          verbose_name_plural = 'Patches'
> -        if django.VERSION >= (1, 10):
> -            base_manager_name = 'objects'
> +        base_manager_name = 'objects'
>  
>  
>  class Comment(EmailMixin, models.Model):
> diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py
> index 4b0d5513..f96f3694 100644
> --- a/patchwork/settings/base.py
> +++ b/patchwork/settings/base.py
> @@ -4,14 +4,12 @@ Base settings for patchwork project.
>  
>  import os
>  
> -import django
> -
>  ROOT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)),
>                          os.pardir, os.pardir)
>  
>  #
>  # Core settings
> -# https://docs.djangoproject.com/en/1.8/ref/settings/#core-settings
> +# https://docs.djangoproject.com/en/1.11/ref/settings/#core-settings
>  #
>  
>  INSTALLED_APPS = [
> @@ -26,7 +24,7 @@ INSTALLED_APPS = [
>      'patchwork',
>  ]
>  
> -_MIDDLEWARE_CLASSES = [
> +MIDDLEWARE = [
>      'django.middleware.common.CommonMiddleware',
>      'django.contrib.sessions.middleware.SessionMiddleware',
>      'django.contrib.auth.middleware.AuthenticationMiddleware',
> @@ -37,11 +35,6 @@ _MIDDLEWARE_CLASSES = [
>      'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>  ]
>  
> -if django.VERSION >= (1, 10):
> -    MIDDLEWARE = _MIDDLEWARE_CLASSES
> -else:
> -    MIDDLEWARE_CLASSES = _MIDDLEWARE_CLASSES
> -
>  TIME_ZONE = 'Australia/Canberra'
>  
>  LANGUAGE_CODE = 'en-au'
> @@ -83,7 +76,7 @@ SERVER_EMAIL = DEFAULT_FROM_EMAIL
>  
>  #
>  # Auth settings
> -# https://docs.djangoproject.com/en/1.8/ref/settings/#auth
> +# https://docs.djangoproject.com/en/1.11/ref/settings/#auth
>  #
>  
>  LOGIN_URL = 'auth_login'
> @@ -93,7 +86,7 @@ LOGIN_REDIRECT_URL = 'user-profile'
>  
>  #
>  # Sites settings
> -# https://docs.djangoproject.com/en/1.8/ref/settings/#sites
> +# https://docs.djangoproject.com/en/1.11/ref/settings/#sites
>  #
>  
>  SITE_ID = 1
> @@ -101,7 +94,7 @@ SITE_ID = 1
>  
>  #
>  # Static files settings
> -# https://docs.djangoproject.com/en/1.8/ref/settings/#static-files
> +# https://docs.djangoproject.com/en/1.11/ref/settings/#static-files
>  #
>  
>  STATIC_URL = '/static/'
> diff --git a/patchwork/settings/dev.py b/patchwork/settings/dev.py
> index 7bdfdffa..62d98929 100644
> --- a/patchwork/settings/dev.py
> +++ b/patchwork/settings/dev.py
> @@ -9,13 +9,11 @@ Design based on:
>  
>  from __future__ import absolute_import
>  
> -import django
> -
>  from .base import *  # noqa
>  
>  #
>  # Core settings
> -# https://docs.djangoproject.com/en/1.8/ref/settings/#core-settings
> +# https://docs.djangoproject.com/en/1.11/ref/settings/#core-settings
>  #
>  
>  
> @@ -46,11 +44,11 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
>  
>  #
>  # Auth settings
> -# https://docs.djangoproject.com/en/1.8/ref/settings/#auth
> +# https://docs.djangoproject.com/en/1.11/ref/settings/#auth
>  #
>  
>  # Use a faster, though less secure, password hasher for faster tests
> -# https://docs.djangoproject.com/es/1.9/topics/testing/overview/#password-hashing
> +# https://docs.djangoproject.com/es/1.11/topics/testing/overview/#password-hashing
>  PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
>  
>  #
> @@ -66,14 +64,9 @@ INSTALLED_APPS += [
>  DEBUG_TOOLBAR_PATCH_SETTINGS = False
>  
>  # This should go first in the middleware classes
> -if django.VERSION >= (1, 10):
> -    MIDDLEWARE = [
> -        'debug_toolbar.middleware.DebugToolbarMiddleware',
> -    ] + MIDDLEWARE
> -else:
> -    MIDDLEWARE_CLASSES = [
> -        'debug_toolbar.middleware.DebugToolbarMiddleware',
> -    ] + MIDDLEWARE_CLASSES
> +MIDDLEWARE = [
> +    'debug_toolbar.middleware.DebugToolbarMiddleware',
> +] + MIDDLEWARE
>  
>  INTERNAL_IPS = [
>      '127.0.0.1', '::1',
> diff --git a/patchwork/settings/production.example.py b/patchwork/settings/production.example.py
> index e97ba578..0c7a88c0 100644
> --- a/patchwork/settings/production.example.py
> +++ b/patchwork/settings/production.example.py
> @@ -15,7 +15,7 @@ from .base import *  # noqa
>  
>  #
>  # Core settings
> -# https://docs.djangoproject.com/en/1.8/ref/settings/#core-settings
> +# https://docs.djangoproject.com/en/1.11/ref/settings/#core-settings
>  #
>  
>  # Security
> @@ -51,7 +51,7 @@ ADMINS = (
>  #
>  # If you're using a postgres database, connecting over a local unix-domain
>  # socket, then the following setting should work for you. Otherwise,
> -# see https://docs.djangoproject.com/en/1.8/ref/settings/#databases
> +# see https://docs.djangoproject.com/en/1.11/ref/settings/#databases
>  
>  DATABASES = {
>      'default': {
> @@ -66,8 +66,8 @@ DATABASES = {
>  
>  #
>  # Static files settings
> -# https://docs.djangoproject.com/en/1.8/ref/settings/#static-files
> -# https://docs.djangoproject.com/en/1.8/ref/contrib/staticfiles/#manifeststaticfilesstorage
> +# https://docs.djangoproject.com/en/1.11/ref/settings/#static-files
> +# https://docs.djangoproject.com/en/1.11/ref/contrib/staticfiles/#manifeststaticfilesstorage
>  #
>  
>  STATIC_ROOT = os.environ.get('STATIC_ROOT', '/srv/patchwork/htdocs/static')
> diff --git a/requirements-dev.txt b/requirements-dev.txt
> index 1d58df71..8bad8f07 100644
> --- a/requirements-dev.txt
> +++ b/requirements-dev.txt
> @@ -1,4 +1,4 @@
> -Django>=1.8,<2.0
> +Django>=1.11,<2.0
>  djangorestframework>=3.4,<3.9
>  django-filter>=1.0,<1.2
>  -r requirements-test.txt
> diff --git a/requirements-prod.txt b/requirements-prod.txt
> index 59e2c1e6..c30688cc 100644
> --- a/requirements-prod.txt
> +++ b/requirements-prod.txt
> @@ -1,4 +1,4 @@
> -Django>=1.8,<2.0
> +Django>=1.11,<2.0
>  djangorestframework>=3.4,<3.9
>  django-filter>=1.0,<1.2
>  psycopg2>=2.7,<2.8
> diff --git a/tox.ini b/tox.ini
> index 9aac8247..5f3d7e72 100644
> --- a/tox.ini
> +++ b/tox.ini
> @@ -1,20 +1,14 @@
>  [tox]
>  minversion = 2.0
> -envlist = pep8,docs,py{27,34,35}-django{18,19,110,111},py36-django111
> +envlist = pep8,docs,py{27,34,35,36}-django111
>  skipsdist = True
>  
>  [testenv]
>  deps =
>      -r{toxinidir}/requirements-test.txt
> -    django18: django>=1.8,<1.9
> -    django19: django>=1.9,<1.10
> -    django110: django>=1.10,<1.11
>      django111: django>=1.11,<2.0
> -    django{18,19}: djangorestframework>=3.4,<3.7
> -    django110: djangorestframework>=3.4,<3.9
>      django111: djangorestframework>=3.6,<3.9
> -    django18: django-filter>=1.0,<1.1
> -    django{19,110,111}: django-filter>=1.0,<1.2
> +    django111: django-filter>=1.0,<1.2
>  setenv =
>      DJANGO_SETTINGS_MODULE = patchwork.settings.dev
>      PYTHONDONTWRITEBYTECODE = 1
> -- 
> 2.17.1
>
> _______________________________________________
> Patchwork mailing list
> Patchwork at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork


More information about the Patchwork mailing list