diff options
Diffstat (limited to 'community/py3-django-treebeard/0011-Declare-support-for-Django-3-and-drop-support-for-EO.patch')
-rw-r--r-- | community/py3-django-treebeard/0011-Declare-support-for-Django-3-and-drop-support-for-EO.patch | 936 |
1 files changed, 0 insertions, 936 deletions
diff --git a/community/py3-django-treebeard/0011-Declare-support-for-Django-3-and-drop-support-for-EO.patch b/community/py3-django-treebeard/0011-Declare-support-for-Django-3-and-drop-support-for-EO.patch deleted file mode 100644 index 540277928f9..00000000000 --- a/community/py3-django-treebeard/0011-Declare-support-for-Django-3-and-drop-support-for-EO.patch +++ /dev/null @@ -1,936 +0,0 @@ -From 7ea2fef9675e8d2f2dab09eeeb2f24d958f7cb4c Mon Sep 17 00:00:00 2001 -From: Samir Shah <solaris.smoke@gmail.com> -Date: Mon, 6 Jul 2020 07:38:27 +0300 -Subject: [PATCH 11/11] Declare support for Django 3 and drop support for EOL - Django versions. - ---- - .travis.yml | 96 +++++++--------------- - README.rst | 4 +- - appveyor.yml | 9 ++- - docs/source/install.rst | 4 +- - docs/source/tests.rst | 21 ++--- - docs/source/tutorial.rst | 5 -- - setup.cfg | 3 - - setup.py | 15 ++-- - tox.ini | 12 +-- - treebeard/__init__.py | 1 - - treebeard/admin.py | 50 ++++-------- - treebeard/al_tree.py | 2 +- - treebeard/forms.py | 2 +- - treebeard/models.py | 17 ++-- - treebeard/mp_tree.py | 6 +- - treebeard/ns_tree.py | 7 +- - treebeard/templatetags/admin_tree.py | 69 ++++------------ - treebeard/tests/settings.py | 19 +---- - treebeard/tests/test_treebeard.py | 114 ++++++++------------------- - 19 files changed, 129 insertions(+), 327 deletions(-) - -diff --git a/.travis.yml b/.travis.yml -index 4c7fe65..5200466 100644 ---- a/.travis.yml -+++ b/.travis.yml -@@ -13,75 +13,6 @@ addons: - - matrix: - include: -- # -- # Django 1.11 -- - python: 2.7 -- env: TOXENV=py27-dj111-sqlite -- - python: 3.5 -- env: TOXENV=py35-dj111-sqlite -- - python: 3.6 -- env: TOXENV=py36-dj111-sqlite -- -- - python: 2.7 -- env: TOXENV=py27-dj111-postgres -- - python: 3.5 -- env: TOXENV=py35-dj111-postgres -- - python: 3.6 -- env: TOXENV=py36-dj111-postgres -- -- - python: 2.7 -- env: TOXENV=py27-dj111-mysql -- - python: 3.5 -- env: TOXENV=py35-dj111-mysql -- - python: 3.6 -- env: TOXENV=py36-dj111-mysql -- -- # -- # Django 2.0 -- - python: 3.5 -- env: TOXENV=py35-dj20-sqlite -- - python: 3.6 -- env: TOXENV=py36-dj20-sqlite -- - python: 3.7 -- env: TOXENV=py37-dj20-sqlite -- -- - python: 3.5 -- env: TOXENV=py35-dj20-postgres -- - python: 3.6 -- env: TOXENV=py36-dj20-postgres -- - python: 3.7 -- env: TOXENV=py37-dj20-postgres -- -- - python: 3.5 -- env: TOXENV=py35-dj20-mysql -- - python: 3.6 -- env: TOXENV=py36-dj20-mysql -- - python: 3.7 -- env: TOXENV=py37-dj20-mysql -- -- # -- # Django 2.1 -- - python: 3.5 -- env: TOXENV=py35-dj21-sqlite -- - python: 3.6 -- env: TOXENV=py36-dj21-sqlite -- - python: 3.7 -- env: TOXENV=py37-dj21-sqlite -- -- - python: 3.5 -- env: TOXENV=py35-dj21-postgres -- - python: 3.6 -- env: TOXENV=py36-dj21-postgres -- - python: 3.7 -- env: TOXENV=py37-dj21-postgres -- -- - python: 3.5 -- env: TOXENV=py35-dj21-mysql -- - python: 3.6 -- env: TOXENV=py36-dj21-mysql -- - python: 3.7 -- env: TOXENV=py37-dj21-mysql -- - # - # Django 2.2 - - python: 3.5 -@@ -97,6 +28,8 @@ matrix: - env: TOXENV=py36-dj22-postgres - - python: 3.7 - env: TOXENV=py37-dj22-postgres -+ - python: 3.8 -+ env: TOXENV=py38-dj22-postgres - - - python: 3.5 - env: TOXENV=py35-dj22-mysql -@@ -104,6 +37,31 @@ matrix: - env: TOXENV=py36-dj22-mysql - - python: 3.7 - env: TOXENV=py37-dj22-mysql -+ - python: 3.8 -+ env: TOXENV=py38-dj22-mysql -+ -+ # -+ # Django 3.0 -+ - python: 3.6 -+ env: TOXENV=py36-dj30-sqlite -+ - python: 3.7 -+ env: TOXENV=py37-dj30-sqlite -+ - python: 3.8 -+ env: TOXENV=py38-dj30-sqlite -+ -+ - python: 3.6 -+ env: TOXENV=py36-dj30-postgres -+ - python: 3.7 -+ env: TOXENV=py37-dj30-postgres -+ - python: 3.8 -+ env: TOXENV=py38-dj30-postgres -+ -+ - python: 3.6 -+ env: TOXENV=py36-dj30-mysql -+ - python: 3.7 -+ env: TOXENV=py37-dj30-mysql -+ - python: 3.8 -+ env: TOXENV=py38-dj30-mysql - - before_install: - - sudo apt-get update -diff --git a/README.rst b/README.rst -index 62abe1a..97551ca 100644 ---- a/README.rst -+++ b/README.rst -@@ -50,6 +50,6 @@ Supported versions - - **django-treebeard** officially supports - --* Django 1.11 - 2.2 --* Python 2.7, 3.4, 3.5, 3.6 -+* Django 2.2 - 3.0 -+* Python 3.5, 3.6, 3.7, 3.8 - * PostgreSQL, MySQL, SQLite database back-ends. -diff --git a/appveyor.yml b/appveyor.yml -index 0514065..6f92122 100644 ---- a/appveyor.yml -+++ b/appveyor.yml -@@ -3,9 +3,12 @@ services: - - environment: - matrix: -- - TOXENV: py36-dj111-mssql -- - TOXENV: py36-dj20-mssql -- - TOXENV: py36-dj21-mssql -+ - TOXENV: py36-dj22-mssql -+ - TOXENV: py37-dj22-mssql -+ - TOXENV: py38-dj22-mssql -+ - TOXENV: py36-dj30-mssql -+ - TOXENV: py37-dj30-mssql -+ - TOXENV: py38-dj30-mssql - - matrix: - fast_finish: true -diff --git a/docs/source/install.rst b/docs/source/install.rst -index 1c579fd..1e6790c 100644 ---- a/docs/source/install.rst -+++ b/docs/source/install.rst -@@ -5,8 +5,7 @@ Installation - Prerequisites - ------------- - --``django-treebeard`` needs at least **Python 2.7/3.4** to run, and --**Django 1.8 or later**. -+``django-treebeard`` needs at least **Python 3.5** to run, and **Django 2.2 or later**. - - - Installing -@@ -84,4 +83,3 @@ settings file. - - .. _`django-treebeard's PyPI page`: - https://pypi.org/project/django-treebeard/ -- -diff --git a/docs/source/tests.rst b/docs/source/tests.rst -index f75d11e..f564041 100644 ---- a/docs/source/tests.rst -+++ b/docs/source/tests.rst -@@ -39,20 +39,13 @@ tox - --- - - ``django-treebeard`` uses `tox`_ to run the test suite in all the supported --environments: -- -- - py27-dj16-sqlite -- - py27-dj16-mysql -- - py27-dj16-pgsql -- - py27-dj17-sqlite -- - py27-dj17-mysql -- - py27-dj17-pgsql -- - py34-dj16-sqlite -- - py34-dj16-pgsql -- - py34-dj17-sqlite -- - py34-dj17-pgsql -- --This means that the test suite will run 10 times to test every -+environments - permutations of: -+ -+ - Python 3.5, 3.6, 3.7 and 3.8 -+ - Django 2.2 and 3.0 -+ - Sqlite, MySQL and PostgreSQL -+ -+This means that the test suite will run 24 times to test every - environment supported by ``django-treebeard``. This takes a long time. - If you want to test only one or a few environments, please use the `-e` - option in `tox`_, like: -diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst -index 1af5adc..cb5a1aa 100644 ---- a/docs/source/tutorial.rst -+++ b/docs/source/tutorial.rst -@@ -6,11 +6,9 @@ Create a basic model for your tree. In this example we'll use a Materialized Pat - .. code-block:: python - - from django.db import models -- from django.utils.encoding import python_2_unicode_compatible - - from treebeard.mp_tree import MP_Node - -- @python_2_unicode_compatible - class Category(MP_Node): - name = models.CharField(max_length=30) - -@@ -19,9 +17,6 @@ Create a basic model for your tree. In this example we'll use a Materialized Pat - def __str__(self): - return 'Category: {}'.format(self.name) - --This example works on Python 3 as well as on Python 2. If you don't need Python 2 support --remove the ``@python_2_unicode_compatible`` decorator. -- - - Run syncdb: - -diff --git a/setup.cfg b/setup.cfg -index ed8a958..0c9e0fc 100644 ---- a/setup.cfg -+++ b/setup.cfg -@@ -1,5 +1,2 @@ --[bdist_wheel] --universal = 1 -- - [metadata] - license_file = LICENSE -diff --git a/setup.py b/setup.py -index 550f28e..aa70a38 100644 ---- a/setup.py -+++ b/setup.py -@@ -1,7 +1,5 @@ - #!/usr/bin/env python - # -*- coding: utf-8 -*- --from __future__ import unicode_literals -- - import os - from setuptools import setup, find_packages - from treebeard import __version__ -@@ -26,7 +24,7 @@ setup_args = dict( - include_package_data=True, - description='Efficient tree implementations for Django', - long_description=codecs.open(os.path.join(root_dir(), 'README.rst'), encoding='utf-8').read(), -- install_requires=['Django>=1.8'], -+ install_requires=['Django>=2.2'], - tests_require=['pytest'], - classifiers=[ - 'Development Status :: 5 - Production/Stable', -@@ -34,16 +32,13 @@ setup_args = dict( - 'License :: OSI Approved :: Apache Software License', - 'Environment :: Web Environment', - 'Framework :: Django', -- 'Framework :: Django :: 1.8', -- 'Framework :: Django :: 1.9', -- 'Framework :: Django :: 1.10', -- 'Framework :: Django :: 1.11', -- 'Framework :: Django :: 2.0', -+ 'Framework :: Django :: 2.2', -+ 'Framework :: Django :: 3.0', - 'Programming Language :: Python', -- 'Programming Language :: Python :: 2.7', -- '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', - 'Operating System :: OS Independent', - 'Topic :: Software Development :: Libraries', - 'Topic :: Utilities']) -diff --git a/tox.ini b/tox.ini -index 777fae6..8b2e8ab 100644 ---- a/tox.ini -+++ b/tox.ini -@@ -9,7 +9,7 @@ - # see https://github.com/michiya/django-pyodbc-azure/issues/192 ; - # as a result, environments *-dj22-mssql are not actually usable. - envlist = -- {py27,py35,py36,py37}-{dj111,dj20,dj21,dj22}-{sqlite,postgres,mysql,mssql} -+ {py35,py36,py37,py38}-{dj22,dj30}-{sqlite,postgres,mysql,mssql} - - [testenv:docs] - basepython = python -@@ -23,18 +23,14 @@ commands = - [testenv] - deps = - pytest>=3.0 -- dj111: Django>=1.11,<2.0 -- dj20: Django>=2.0,<2.1 -- dj21: Django>=2.1,<2.2 - dj22: Django>=2.2,<3.0 -+ dj30: Django>=3.0,<3.1 - postgres: psycopg2>=2.6 - mysql: mysqlclient>=1.3.9 -- dj111-mssql: django-pyodbc-azure==1.11.15.0 -- dj20-mssql: django-pyodbc-azure==2.0.8.0 -- dj21-mssql: django-pyodbc-azure==2.1.0.0 - dj22-mssql: django-pyodbc-azure==2.1.0.0 -+ dj30-mssql: django-pyodbc-azure==2.1.0.0 - --setenv = -+setenv = - sqlite: DATABASE_ENGINE=sqlite - postgres: DATABASE_ENGINE=psql - mysql: DATABASE_ENGINE=mysql -diff --git a/treebeard/__init__.py b/treebeard/__init__.py -index c1f4801..00d37f5 100644 ---- a/treebeard/__init__.py -+++ b/treebeard/__init__.py -@@ -1,5 +1,4 @@ - # -*- coding: utf-8 -*- --from __future__ import unicode_literals - """ - See PEP 386 (https://www.python.org/dev/peps/pep-0386/) - -diff --git a/treebeard/admin.py b/treebeard/admin.py -index 4511d57..6737c67 100644 ---- a/treebeard/admin.py -+++ b/treebeard/admin.py -@@ -2,30 +2,20 @@ - - import sys - --import django -- - from django.conf import settings - from django.conf.urls import url - - from django.contrib import admin, messages -+from django.contrib.admin.options import TO_FIELD_VAR - from django.http import HttpResponse, HttpResponseBadRequest --from django.utils.translation import ugettext_lazy as _ --if sys.version_info >= (3, 0): -- from django.utils.encoding import force_str --else: -- from django.utils.encoding import force_unicode as force_str -+from django.utils.translation import gettext_lazy as _ -+from django.utils.encoding import force_str - - from treebeard.exceptions import (InvalidPosition, MissingNodeOrderBy, - InvalidMoveToDescendant, PathOverflow) - from treebeard.al_tree import AL_Node - - --try: -- from django.contrib.admin.options import TO_FIELD_VAR --except ImportError: -- from django.contrib.admin.views.main import TO_FIELD_VAR -- -- - class TreeAdmin(admin.ModelAdmin): - """Django Admin class for treebeard.""" - -@@ -46,18 +36,15 @@ class TreeAdmin(admin.ModelAdmin): - self.change_list_template = 'admin/tree_list.html' - if extra_context is None: - extra_context = {} -- if django.VERSION < (1, 10): -- request_context = 'django.core.context_processors.request' in settings.TEMPLATE_CONTEXT_PROCESSORS -- else: -- request_context = any( -- map( -- lambda tmpl: -- tmpl.get('BACKEND', None) == 'django.template.backends.django.DjangoTemplates' and -- tmpl.get('APP_DIRS', False) and -- 'django.template.context_processors.request' in tmpl.get('OPTIONS', {}).get('context_processors', []), -- settings.TEMPLATES -- ) -+ request_context = any( -+ map( -+ lambda tmpl: -+ tmpl.get('BACKEND', None) == 'django.template.backends.django.DjangoTemplates' and -+ tmpl.get('APP_DIRS', False) and -+ 'django.template.context_processors.request' in tmpl.get('OPTIONS', {}).get('context_processors', []), -+ settings.TEMPLATES - ) -+ ) - lacks_request = ('request' not in extra_context and not request_context) - if lacks_request: - extra_context['request'] = request -@@ -68,17 +55,12 @@ class TreeAdmin(admin.ModelAdmin): - Adds a url to move nodes to this admin - """ - urls = super(TreeAdmin, self).get_urls() -+ from django.views.i18n import JavaScriptCatalog - -- if django.VERSION < (1, 10): -- from django.views.i18n import javascript_catalog -- jsi18n_url = url(r'^jsi18n/$', javascript_catalog, {'packages': ('treebeard',)}) -- else: -- from django.views.i18n import JavaScriptCatalog -- -- jsi18n_url = url(r'^jsi18n/$', -- JavaScriptCatalog.as_view(packages=['treebeard']), -- name='javascript-catalog' -- ) -+ jsi18n_url = url(r'^jsi18n/$', -+ JavaScriptCatalog.as_view(packages=['treebeard']), -+ name='javascript-catalog' -+ ) - - new_urls = [ - url('^move/$', self.admin_site.admin_view(self.move_node), ), -diff --git a/treebeard/al_tree.py b/treebeard/al_tree.py -index c9b9ee5..8ac408a 100644 ---- a/treebeard/al_tree.py -+++ b/treebeard/al_tree.py -@@ -2,7 +2,7 @@ - - from django.core import serializers - from django.db import models, transaction --from django.utils.translation import ugettext_noop as _ -+from django.utils.translation import gettext_noop as _ - from treebeard.exceptions import InvalidMoveToDescendant, NodeAlreadySaved - from treebeard.models import Node - -diff --git a/treebeard/forms.py b/treebeard/forms.py -index ddd6c82..98c7289 100644 ---- a/treebeard/forms.py -+++ b/treebeard/forms.py -@@ -6,7 +6,7 @@ from django.forms.models import BaseModelForm, ErrorList, model_to_dict - from django.forms.models import modelform_factory as django_modelform_factory - from django.utils.html import escape - from django.utils.safestring import mark_safe --from django.utils.translation import ugettext_lazy as _ -+from django.utils.translation import gettext_lazy as _ - - from treebeard.al_tree import AL_Node - from treebeard.mp_tree import MP_Node -diff --git a/treebeard/models.py b/treebeard/models.py -index 8db6211..01f790c 100644 ---- a/treebeard/models.py -+++ b/treebeard/models.py -@@ -1,12 +1,8 @@ - """Models and base API""" - --import sys - import operator -+from functools import reduce - --if sys.version_info >= (3, 0): -- from functools import reduce -- --import django - from django.db.models import Q - from django.db import models, transaction, router, connections - -@@ -26,7 +22,7 @@ class Node(models.Model): - position, use :meth:`add_sibling` in an already existing root node - instead. - -- :param \*\*kwargs: object creation data that will be passed to the -+ :param `**kwargs`: object creation data that will be passed to the - inherited Node model - :param instance: Instead of passing object creation data, you can - pass an already-constructed (but not yet saved) model instance to -@@ -50,10 +46,7 @@ class Node(models.Model): - field.get_internal_type() == 'ForeignKey' and - field.name != 'parent' - ): -- if django.VERSION >= (1, 9): -- foreign_keys[field.name] = field.remote_field.model -- else: -- foreign_keys[field.name] = field.rel.to -+ foreign_keys[field.name] = field.remote_field.model - return foreign_keys - - @classmethod -@@ -368,7 +361,7 @@ class Node(models.Model): - use the :meth:`add_sibling` method of an already existing - child node instead. - -- :param \*\*kwargs: -+ :param `**kwargs`: - - Object creation data that will be passed to the inherited Node - model -@@ -400,7 +393,7 @@ class Node(models.Model): - - ``sorted-sibling``: the new node will be at the right position - according to the value of node_order_by - -- :param \*\*kwargs: -+ :param `**kwargs`: - - Object creation data that will be passed to the inherited - Node model -diff --git a/treebeard/mp_tree.py b/treebeard/mp_tree.py -index 7ec9e43..0c2a068 100644 ---- a/treebeard/mp_tree.py -+++ b/treebeard/mp_tree.py -@@ -2,14 +2,12 @@ - - import sys - import operator -- --if sys.version_info >= (3, 0): -- from functools import reduce -+from functools import reduce - - from django.core import serializers - from django.db import models, transaction, connection - from django.db.models import F, Q --from django.utils.translation import ugettext_noop as _ -+from django.utils.translation import gettext_noop as _ - - from treebeard.numconv import NumConv - from treebeard.models import Node -diff --git a/treebeard/ns_tree.py b/treebeard/ns_tree.py -index 9cdc4b3..a7909a0 100644 ---- a/treebeard/ns_tree.py -+++ b/treebeard/ns_tree.py -@@ -1,15 +1,12 @@ - """Nested Sets""" - --import sys - import operator -- --if sys.version_info >= (3, 0): -- from functools import reduce -+from functools import reduce - - from django.core import serializers - from django.db import connection, models, transaction - from django.db.models import Q --from django.utils.translation import ugettext_noop as _ -+from django.utils.translation import gettext_noop as _ - - from treebeard.exceptions import InvalidMoveToDescendant, NodeAlreadySaved - from treebeard.models import Node -diff --git a/treebeard/templatetags/admin_tree.py b/treebeard/templatetags/admin_tree.py -index 89c0754..e446cf9 100644 ---- a/treebeard/templatetags/admin_tree.py -+++ b/treebeard/templatetags/admin_tree.py -@@ -6,75 +6,42 @@ nodes change list - @jjdelc - """ - - import datetime --import sys -+from urllib.parse import urljoin - --import django - from django.db import models - from django.conf import settings - from django.contrib.admin.templatetags.admin_list import ( - result_headers, result_hidden_fields) --try: -- from django.contrib.admin.utils import ( -- lookup_field, display_for_field, display_for_value) --except ImportError: # < Django 1.8 -- from django.contrib.admin.util import ( -- lookup_field, display_for_field, display_for_value) -+from django.contrib.admin.utils import ( -+ lookup_field, display_for_field, display_for_value) - from django.core.exceptions import ObjectDoesNotExist - from django.template import Library --from django.utils.html import conditional_escape -+from django.utils.encoding import force_str -+from django.utils.html import conditional_escape, format_html - from django.utils.safestring import mark_safe --from django.utils.translation import ugettext_lazy as _ -+from django.utils.translation import gettext_lazy as _ - -+from treebeard.templatetags import needs_checkboxes - --if sys.version < '3': -- import codecs -- -- def u(x): -- return codecs.unicode_escape_decode(x)[0] --else: -- def u(x): -- return x - - register = Library() - --if sys.version_info >= (3, 0): -- from django.utils.encoding import force_str -- from urllib.parse import urljoin --else: -- from django.utils.encoding import force_unicode as force_str -- from urlparse import urljoin -- -- --from django.utils.html import format_html -- --from treebeard.templatetags import needs_checkboxes -- - - def get_result_and_row_class(cl, field_name, result): -- if django.VERSION >= (1, 9): -- empty_value_display = cl.model_admin.get_empty_value_display() -- else: -- from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE -- empty_value_display = EMPTY_CHANGELIST_VALUE -+ empty_value_display = cl.model_admin.get_empty_value_display() - row_classes = ['field-%s' % field_name] - try: - f, attr, value = lookup_field(field_name, result, cl.model_admin) - except ObjectDoesNotExist: - result_repr = empty_value_display - else: -- if django.VERSION >= (1, 9): -- empty_value_display = getattr( -- attr, 'empty_value_display', empty_value_display) -+ empty_value_display = getattr(attr, 'empty_value_display', empty_value_display) - if f is None: - if field_name == 'action_checkbox': - row_classes = ['action-checkbox'] - allow_tags = getattr(attr, 'allow_tags', False) - boolean = getattr(attr, 'boolean', False) -- if django.VERSION >= (1, 9): -- result_repr = display_for_value( -- value, empty_value_display, boolean) -- else: -- result_repr = display_for_value(value, boolean) -+ result_repr = display_for_value(value, empty_value_display, boolean) - # Strip HTML tags in the resulting text, except if the - # function has an "allow_tags" attribute set to True. - # WARNING: this will be deprecated in Django 2.0 -@@ -83,19 +50,14 @@ def get_result_and_row_class(cl, field_name, result): - if isinstance(value, (datetime.date, datetime.time)): - row_classes.append('nowrap') - else: -- related_field_name = 'rel' if django.VERSION <= (2, 0) else 'remote_field' -- if isinstance(getattr(f, related_field_name), models.ManyToOneRel): -+ if isinstance(getattr(f, 'remote_field'), models.ManyToOneRel): - field_val = getattr(result, f.name) - if field_val is None: - result_repr = empty_value_display - else: - result_repr = field_val - else: -- if django.VERSION >= (1, 9): -- result_repr = display_for_field( -- value, f, empty_value_display) -- else: -- result_repr = display_for_field(value, f) -+ result_repr = display_for_field(value, f, empty_value_display) - if isinstance(f, (models.DateField, models.TimeField, - models.ForeignKey)): - row_classes.append('nowrap') -@@ -172,7 +134,7 @@ def items_for_result(cl, result, form): - ' onclick="opener.dismissRelatedLookupPopup(window, %s);' - ' return false;"') - yield mark_safe( -- u('%s<%s%s>%s %s <a href="%s"%s>%s</a></%s>') % ( -+ '%s<%s%s>%s %s <a href="%s"%s>%s</a></%s>' % ( - drag_handler, table_tag, row_class, spacer, collapse, url, - (cl.is_popup and onclickstr % result_id or ''), - conditional_escape(result_repr), table_tag)) -@@ -190,10 +152,9 @@ def items_for_result(cl, result, form): - ): - bf = form[field_name] - result_repr = mark_safe(force_str(bf.errors) + force_str(bf)) -- yield format_html(u('<td{0}>{1}</td>'), row_class, result_repr) -+ yield format_html('<td{0}>{1}</td>', row_class, result_repr) - if form and not form[cl.model._meta.pk.name].is_hidden: -- yield format_html(u('<td>{0}</td>'), -- force_str(form[cl.model._meta.pk.name])) -+ yield format_html('<td>{0}</td>', force_str(form[cl.model._meta.pk.name])) - - - def get_parent_id(node): -diff --git a/treebeard/tests/settings.py b/treebeard/tests/settings.py -index 39c9d43..47cc1c8 100644 ---- a/treebeard/tests/settings.py -+++ b/treebeard/tests/settings.py -@@ -3,7 +3,6 @@ Django settings for testing treebeard - """ - - import os --import django - - - def get_db_conf(): -@@ -43,7 +42,7 @@ def get_db_conf(): - 'NAME': 'master', - 'USER': 'sa', - 'PASSWORD': 'Password12!', -- 'HOST': '(local)\SQL2016', -+ 'HOST': '(local)\\SQL2016', - 'PORT': '', - 'OPTIONS': { - 'driver': 'SQL Server Native Client 11.0', -@@ -67,21 +66,9 @@ INSTALLED_APPS = [ - # This little hacks forces Django into the old syncdb behaviour, - # creating models without migrations. - --if django.VERSION >= (1, 9): -- MIGRATION_MODULES = {app.split('.')[-1]: None for app in INSTALLED_APPS} --else: -- class DisableMigrations(object): -+MIGRATION_MODULES = {app.split('.')[-1]: None for app in INSTALLED_APPS} - -- def __contains__(self, item): -- return True -- -- def __getitem__(self, item): -- return "notmigrations" -- -- -- MIGRATION_MODULES = DisableMigrations() -- --MIDDLEWARE_CLASSES = [ -+MIDDLEWARE = [ - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware' -diff --git a/treebeard/tests/test_treebeard.py b/treebeard/tests/test_treebeard.py -index fbf86f3..b8049f0 100644 ---- a/treebeard/tests/test_treebeard.py -+++ b/treebeard/tests/test_treebeard.py -@@ -1,11 +1,9 @@ - # -*- coding: utf-8 -*- - """Unit/Functional tests""" - --from __future__ import unicode_literals - import datetime - import os - --from django import VERSION as DJANGO_VERSION - from django.contrib.admin.sites import AdminSite - from django.contrib.admin.views.main import ChangeList - from django.contrib.auth.models import User, AnonymousUser -@@ -2374,16 +2372,10 @@ class TestAdminTree(TestNonEmptyTree): - m = admin_class(model, site) - list_display = m.get_list_display(request) - list_display_links = m.get_list_display_links(request, list_display) -- if DJANGO_VERSION < (2, 1): -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m) -- else: -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m, None) -+ cl = ChangeList(request, model, list_display, list_display_links, -+ m.list_filter, m.date_hierarchy, m.search_fields, -+ m.list_select_related, m.list_per_page, -+ m.list_max_show_all, m.list_editable, m, None) - cl.formset = None - context = Context({'cl': cl, - 'request': request}) -@@ -2420,16 +2412,10 @@ class TestAdminTree(TestNonEmptyTree): - m = UnicodeModelAdmin(model, site) - list_display = m.get_list_display(request) - list_display_links = m.get_list_display_links(request, list_display) -- if DJANGO_VERSION < (2, 1): -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m) -- else: -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m, None) -+ cl = ChangeList(request, model, list_display, list_display_links, -+ m.list_filter, m.date_hierarchy, m.search_fields, -+ m.list_select_related, m.list_per_page, -+ m.list_max_show_all, m.list_editable, m, None) - cl.formset = None - context = Context({'cl': cl, - 'request': request}) -@@ -2459,16 +2445,10 @@ class TestAdminTree(TestNonEmptyTree): - m = admin_class(model, site) - list_display = m.get_list_display(request) - list_display_links = m.get_list_display_links(request, list_display) -- if DJANGO_VERSION < (2, 1): -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m) -- else: -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m, None) -+ cl = ChangeList(request, model, list_display, list_display_links, -+ m.list_filter, m.date_hierarchy, m.search_fields, -+ m.list_select_related, m.list_per_page, -+ m.list_max_show_all, m.list_editable, m, None) - cl.formset = None - context = Context({'cl': cl, - 'request': request}) -@@ -2482,16 +2462,10 @@ class TestAdminTree(TestNonEmptyTree): - request.user = AnonymousUser() - list_display = m.get_list_display(request) - list_display_links = m.get_list_display_links(request, list_display) -- if DJANGO_VERSION < (2, 1): -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m) -- else: -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m, None) -+ cl = ChangeList(request, model, list_display, list_display_links, -+ m.list_filter, m.date_hierarchy, m.search_fields, -+ m.list_select_related, m.list_per_page, -+ m.list_max_show_all, m.list_editable, m, None) - cl.formset = None - context = Context({'cl': cl, - 'request': request}) -@@ -2505,16 +2479,10 @@ class TestAdminTree(TestNonEmptyTree): - request.user = AnonymousUser() - list_display = m.get_list_display(request) - list_display_links = m.get_list_display_links(request, list_display) -- if DJANGO_VERSION < (2, 1): -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m) -- else: -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m, None) -+ cl = ChangeList(request, model, list_display, list_display_links, -+ m.list_filter, m.date_hierarchy, m.search_fields, -+ m.list_select_related, m.list_per_page, -+ m.list_max_show_all, m.list_editable, m, None) - cl.formset = None - context = Context({'cl': cl, - 'request': request}) -@@ -2542,16 +2510,10 @@ class TestAdminTreeList(TestNonEmptyTree): - m = admin_class(model, site) - list_display = m.get_list_display(request) - list_display_links = m.get_list_display_links(request, list_display) -- if DJANGO_VERSION < (2, 1): -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m) -- else: -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m, None) -+ cl = ChangeList(request, model, list_display, list_display_links, -+ m.list_filter, m.date_hierarchy, m.search_fields, -+ m.list_select_related, m.list_per_page, -+ m.list_max_show_all, m.list_editable, m, None) - cl.formset = None - context = Context({'cl': cl, - 'request': request}) -@@ -2572,16 +2534,10 @@ class TestAdminTreeList(TestNonEmptyTree): - m = admin_class(model, site) - list_display = m.get_list_display(request) - list_display_links = m.get_list_display_links(request, list_display) -- if DJANGO_VERSION < (2, 1): -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m) -- else: -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m, None) -+ cl = ChangeList(request, model, list_display, list_display_links, -+ m.list_filter, m.date_hierarchy, m.search_fields, -+ m.list_select_related, m.list_per_page, -+ m.list_max_show_all, m.list_editable, m, None) - cl.formset = None - context = Context({'cl': cl, - 'request': request, -@@ -2609,16 +2565,10 @@ class TestAdminTreeList(TestNonEmptyTree): - m = admin_class(model, site) - list_display = m.get_list_display(request) - list_display_links = m.get_list_display_links(request, list_display) -- if DJANGO_VERSION < (2, 1): -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m) -- else: -- cl = ChangeList(request, model, list_display, list_display_links, -- m.list_filter, m.date_hierarchy, m.search_fields, -- m.list_select_related, m.list_per_page, -- m.list_max_show_all, m.list_editable, m, None) -+ cl = ChangeList(request, model, list_display, list_display_links, -+ m.list_filter, m.date_hierarchy, m.search_fields, -+ m.list_select_related, m.list_per_page, -+ m.list_max_show_all, m.list_editable, m, None) - cl.formset = None - context = Context({'cl': cl, - 'request': request}) --- -2.25.4 - |