From a1c3dfbfb5767da261218a37cc14dc93edb658ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= <fpeters@entrouvert.com>
Date: Mon, 27 May 2019 10:19:32 +0200
Subject: [PATCH] general: stop supporting django 1.8 (#33423)

---
 Jenkinsfile              |  2 +-
 combo/apps/maps/forms.py | 21 ++-------------------
 combo/profile/utils.py   |  7 +------
 combo/utils/forms.py     |  7 +------
 debian/control           |  2 +-
 setup.py                 |  2 +-
 tox.ini                  | 13 ++++++-------
 7 files changed, 13 insertions(+), 41 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index ce6b5e86..f9c46755 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -24,7 +24,7 @@ pipeline {
             steps {
                 script {
                     if (env.JOB_NAME == 'combo' && env.GIT_BRANCH == 'origin/master') {
-                        sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder combo'
+                        sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder -d stretch combo'
                     }
                 }
             }
diff --git a/combo/apps/maps/forms.py b/combo/apps/maps/forms.py
index 908adaa5..75d2539f 100644
--- a/combo/apps/maps/forms.py
+++ b/combo/apps/maps/forms.py
@@ -14,7 +14,6 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-import django
 from django import forms
 from django.utils.encoding import force_text
 from django.utils.text import slugify
@@ -22,24 +21,8 @@ from django.utils.text import slugify
 from .models import MapLayer
 
 
-if django.VERSION < (1, 11, 0):
-    class RadioChoiceInput(forms.widgets.RadioChoiceInput):
-        def render(self, name=None, value=None, *args, **kwargs):
-            value = super(RadioChoiceInput, self).render(name=name, value=value, *args, **kwargs)
-            return u'<span class="icon-%s">%s</span>' % (self.choice_value, value)
-
-
-    class RadioFieldRenderer(forms.widgets.RadioFieldRenderer):
-        choice_input_class = RadioChoiceInput
-
-
-    class IconRadioSelect(forms.RadioSelect):
-        renderer = RadioFieldRenderer
-
-else:
-
-    class IconRadioSelect(forms.RadioSelect):
-        option_template_name = 'maps/icon_radio_option.html'
+class IconRadioSelect(forms.RadioSelect):
+    option_template_name = 'maps/icon_radio_option.html'
 
 
 class MapNewLayerForm(forms.ModelForm):
diff --git a/combo/profile/utils.py b/combo/profile/utils.py
index 357cccfb..22cb55e2 100644
--- a/combo/profile/utils.py
+++ b/combo/profile/utils.py
@@ -16,12 +16,7 @@
 
 from django.conf import settings
 from django.contrib.auth.models import User
-
-import django
-if django.VERSION < (1, 11, 0):
-    CallableFalse, CallableTrue = False, True
-else:
-    from django.utils.deprecation import CallableFalse, CallableTrue
+from django.utils.deprecation import CallableFalse, CallableTrue
 
 if 'mellon' in settings.INSTALLED_APPS:
     from mellon.models import UserSAMLIdentifier
diff --git a/combo/utils/forms.py b/combo/utils/forms.py
index 33398fb2..c1d12b54 100644
--- a/combo/utils/forms.py
+++ b/combo/utils/forms.py
@@ -14,7 +14,6 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-import django
 from django import forms
 from django.utils.datastructures import MultiValueDict
 from django.utils.safestring import mark_safe
@@ -41,11 +40,7 @@ class MultiSortWidget(forms.SelectMultiple):
                 self.choices.insert(0, option_tuple)
 
         # render the <select multiple>
-        if django.VERSION < (1, 11, 0):
-            rendered = super(MultiSortWidget, self).render(name, value,
-                    attrs=attrs, choices=choices)
-        else:
-            rendered = super(MultiSortWidget, self).render(name, value,
+        rendered = super(MultiSortWidget, self).render(name, value,
                     attrs=attrs)
 
         # include it in a <div> that will be turned into an appropriate widget
diff --git a/debian/control b/debian/control
index a4ff06b6..4c12d6d8 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@ X-Python-Version: >= 2.7
 Package: python-combo
 Architecture: all
 Depends: ${misc:Depends}, ${python:Depends},
-    python-django (>= 1.8),
+    python-django (>= 1:1.11),
     python-djangorestframework (>= 3.3),
     python-gadjo (>= 0.53),
     python-pyproj,
diff --git a/setup.py b/setup.py
index 1a577c4a..70086d6d 100644
--- a/setup.py
+++ b/setup.py
@@ -146,7 +146,7 @@ setup(
         'Programming Language :: Python :: 2',
         'Programming Language :: Python :: 3',
     ],
-    install_requires=['django>=1.8, <1.12',
+    install_requires=['django>=1.11, <1.12',
         'django-ckeditor<=4.5.3',
         'gadjo>=0.53',
         'feedparser',
diff --git a/tox.ini b/tox.ini
index eb2de1c7..8610cd03 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
 [tox]
 toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/combo/{env:BRANCH_NAME:}
-envlist = py2-django18,coverage-py2-django111-pylint,py3-django111
+envlist = coverage-py2-pylint,py3
 
 [testenv]
 usedevelop = True
@@ -9,10 +9,10 @@ setenv =
   py2: WCSCTL=wcs/wcsctl.py
   DJANGO_SETTINGS_MODULE=combo.settings
   COMBO_SETTINGS_FILE=tests/settings.py
+  coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov-report html --cov=combo/
 deps =
-  django18: django>=1.8,<1.9
-  django111: django>=1.11,<1.12
-  django111: pywebpush
+  django>=1.11,<1.12
+  pywebpush
   pytest-cov
   pytest-django
   pytest-freezegun
@@ -32,6 +32,5 @@ commands =
   ./getlasso.sh
   python manage.py compilemessages
   ./get_wcs.sh
-  django18: py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=combo/ tests/}
-  django18: ./pylint.sh combo/
-  django111: py.test {posargs: --junitxml=test_{envname}_results.xml tests/}
+  py.test {env:COVERAGE:} {posargs:tests/}
+  ./pylint.sh combo/
-- 
2.20.1

