Drop old Python and Django versions (#220)
* drop old python and django versions * fix tests * remove compat module entirely Co-authored-by: Fabio Caccamo <fabio.caccamo@gmail.com>master
parent
333025f877
commit
d62593e01b
|
|
@ -19,9 +19,6 @@ jobs:
|
||||||
id: create_matrix
|
id: create_matrix
|
||||||
with:
|
with:
|
||||||
matrix: |
|
matrix: |
|
||||||
python-version {2.7}, django-version {1.8,1.9,1.10,1.11}, database {sqlite,postgres}
|
|
||||||
python-version {3.6}, django-version {1.8,1.9,1.10,1.11,2.0,2.1,2.2,3.0,3.1,3.2}, database {sqlite,postgres}
|
|
||||||
python-version {3.7}, django-version {2.0,2.1,2.2,3.0,3.1,3.2}, database {sqlite,postgres}
|
|
||||||
python-version {3.8}, django-version {2.2,3.0,3.1,3.2}, database {sqlite,postgres}
|
python-version {3.8}, django-version {2.2,3.0,3.1,3.2}, database {sqlite,postgres}
|
||||||
python-version {3.9}, django-version {2.2,3.0,3.1,3.2}, database {sqlite,postgres}
|
python-version {3.9}, django-version {2.2,3.0,3.1,3.2}, database {sqlite,postgres}
|
||||||
python-version {3.10}, django-version {3.2,4.0,4.1}, database {sqlite,postgres}
|
python-version {3.10}, django-version {3.2,4.0,4.1}, database {sqlite,postgres}
|
||||||
|
|
|
||||||
|
|
@ -47,20 +47,17 @@ django-admin-interface is a modern **responsive flat admin interface customizabl
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
- Run `pip install django-admin-interface`
|
- Run `pip install django-admin-interface`
|
||||||
- Add `admin_interface`, `flat_responsive`, `flat` and `colorfield` to `settings.INSTALLED_APPS` **before** `django.contrib.admin`
|
- Add `admin_interface` and `colorfield` to `settings.INSTALLED_APPS` **before** `django.contrib.admin`
|
||||||
```python
|
```python
|
||||||
INSTALLED_APPS = (
|
INSTALLED_APPS = (
|
||||||
#...
|
#...
|
||||||
"admin_interface",
|
"admin_interface",
|
||||||
"flat_responsive", # only if django version < 2.0
|
|
||||||
"flat", # only if django version < 1.9
|
|
||||||
"colorfield",
|
"colorfield",
|
||||||
#...
|
#...
|
||||||
"django.contrib.admin",
|
"django.contrib.admin",
|
||||||
#...
|
#...
|
||||||
)
|
)
|
||||||
|
|
||||||
# only if django version >= 3.0
|
|
||||||
X_FRAME_OPTIONS = "SAMEORIGIN"
|
X_FRAME_OPTIONS = "SAMEORIGIN"
|
||||||
SILENCED_SYSTEM_CHECKS = ["security.W019"]
|
SILENCED_SYSTEM_CHECKS = ["security.W019"]
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from admin_interface.compat import gettext_lazy as _
|
|
||||||
from admin_interface.models import Theme
|
from admin_interface.models import Theme
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
from django.db.models.signals import post_migrate
|
from django.db.models.signals import post_migrate
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
from admin_interface.compat import gettext_lazy as _
|
|
||||||
|
|
||||||
|
|
||||||
class AdminInterfaceConfig(AppConfig):
|
class AdminInterfaceConfig(AppConfig):
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache import cache, caches
|
from django.core.cache import cache, caches
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import django
|
|
||||||
|
|
||||||
if django.VERSION >= (1, 11):
|
|
||||||
from django.core.validators import FileExtensionValidator
|
|
||||||
else:
|
|
||||||
|
|
||||||
def FileExtensionValidator(*args, **kwargs):
|
|
||||||
def noop(*args, **kwargs):
|
|
||||||
pass
|
|
||||||
|
|
||||||
return noop
|
|
||||||
|
|
||||||
|
|
||||||
if django.VERSION < (1, 10):
|
|
||||||
from django.core.urlresolvers import NoReverseMatch, reverse
|
|
||||||
else:
|
|
||||||
from django.urls import NoReverseMatch, reverse
|
|
||||||
|
|
||||||
if django.VERSION < (2, 0):
|
|
||||||
from django.utils.encoding import force_text as force_str
|
|
||||||
from django.utils.translation import ugettext_lazy as gettext_lazy
|
|
||||||
else:
|
|
||||||
from django.utils.encoding import force_str
|
|
||||||
from django.utils.translation import gettext_lazy
|
|
||||||
|
|
@ -2,10 +2,9 @@
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.core.validators import FileExtensionValidator
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
from admin_interface.compat import FileExtensionValidator
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,13 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from colorfield.fields import ColorField
|
from colorfield.fields import ColorField
|
||||||
|
from django.core.validators import FileExtensionValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models.signals import post_delete, post_save, pre_save
|
from django.db.models.signals import post_delete, post_save, pre_save
|
||||||
from six import python_2_unicode_compatible
|
from django.utils.encoding import force_str
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from admin_interface.cache import del_cached_active_theme
|
from .cache import del_cached_active_theme
|
||||||
from admin_interface.compat import FileExtensionValidator, force_str
|
|
||||||
from admin_interface.compat import gettext_lazy as _
|
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Theme(models.Model):
|
class Theme(models.Model):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def post_migrate_handler(**kwargs):
|
def post_migrate_handler(**kwargs):
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import django
|
import django
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
|
@ -29,5 +27,3 @@ def check_installed_app(app, max_dj_version=None):
|
||||||
|
|
||||||
def check_installed_apps():
|
def check_installed_apps():
|
||||||
check_installed_app("colorfield")
|
check_installed_app("colorfield")
|
||||||
check_installed_app("flat", max_dj_version=(1, 9))
|
|
||||||
check_installed_app("flat_responsive", max_dj_version=(2, 0))
|
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,7 @@
|
||||||
if (typeof(openerRef.dismissAddRelatedObjectPopup) === 'function') {
|
if (typeof(openerRef.dismissAddRelatedObjectPopup) === 'function') {
|
||||||
openerRef.dismissAddRelatedObjectPopup(windowRef, initData.value, initData.obj);
|
openerRef.dismissAddRelatedObjectPopup(windowRef, initData.value, initData.obj);
|
||||||
}
|
}
|
||||||
else if (typeof(openerRef.dismissAddAnotherPopup) === 'function') {
|
|
||||||
// django 1.7 compatibility
|
|
||||||
openerRef.dismissAddAnotherPopup(windowRef, initData.value, initData.obj);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix for django 1.7
|
// fix for django 1.7 TODO remove
|
||||||
if (iframeSrc.indexOf('_popup=1') === -1) {
|
if (iframeSrc.indexOf('_popup=1') === -1) {
|
||||||
if (iframeSrc.indexOf('?') === -1) {
|
if (iframeSrc.indexOf('?') === -1) {
|
||||||
iframeSrc += '?_popup=1';
|
iframeSrc += '?_popup=1';
|
||||||
|
|
@ -135,10 +135,6 @@ if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined')
|
||||||
window.presentRelatedObjectModal = presentRelatedObjectModal;
|
window.presentRelatedObjectModal = presentRelatedObjectModal;
|
||||||
window.presentRelatedObjectModalOnClickOn = presentRelatedObjectModalOnClickOn;
|
window.presentRelatedObjectModalOnClickOn = presentRelatedObjectModalOnClickOn;
|
||||||
|
|
||||||
// django 1.7 compatibility
|
|
||||||
presentRelatedObjectModalOnClickOn('a.add-another');
|
|
||||||
|
|
||||||
// django 1.8 and above
|
|
||||||
presentRelatedObjectModalOnClickOn('a.related-widget-wrapper-link');
|
presentRelatedObjectModalOnClickOn('a.related-widget-wrapper-link');
|
||||||
|
|
||||||
// raw_id_fields support
|
// raw_id_fields support
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,20 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import django
|
|
||||||
from django import template
|
from django import template
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.template.loader import get_template
|
from django.template.loader import get_template
|
||||||
|
from django.urls import NoReverseMatch, reverse
|
||||||
from django.utils import translation
|
from django.utils import translation
|
||||||
|
|
||||||
from admin_interface.cache import get_cached_active_theme, set_cached_active_theme
|
from admin_interface.cache import get_cached_active_theme, set_cached_active_theme
|
||||||
from admin_interface.compat import NoReverseMatch, reverse
|
|
||||||
from admin_interface.models import Theme
|
from admin_interface.models import Theme
|
||||||
from admin_interface.version import __version__
|
from admin_interface.version import __version__
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
if django.VERSION < (1, 9):
|
|
||||||
simple_tag = register.assignment_tag
|
|
||||||
else:
|
|
||||||
simple_tag = register.simple_tag
|
|
||||||
|
|
||||||
|
@register.simple_tag(takes_context=True)
|
||||||
@simple_tag(takes_context=True)
|
|
||||||
def get_admin_interface_languages(context):
|
def get_admin_interface_languages(context):
|
||||||
if not settings.USE_I18N:
|
if not settings.USE_I18N:
|
||||||
# i18n disabled
|
# i18n disabled
|
||||||
|
|
@ -65,7 +57,7 @@ def get_admin_interface_languages(context):
|
||||||
return langs_data
|
return langs_data
|
||||||
|
|
||||||
|
|
||||||
@simple_tag()
|
@register.simple_tag()
|
||||||
def get_admin_interface_theme():
|
def get_admin_interface_theme():
|
||||||
theme = get_cached_active_theme()
|
theme = get_cached_active_theme()
|
||||||
if not theme:
|
if not theme:
|
||||||
|
|
@ -74,20 +66,20 @@ def get_admin_interface_theme():
|
||||||
return theme
|
return theme
|
||||||
|
|
||||||
|
|
||||||
@simple_tag()
|
@register.simple_tag()
|
||||||
def get_admin_interface_setting(setting):
|
def get_admin_interface_setting(setting):
|
||||||
theme = get_admin_interface_theme()
|
theme = get_admin_interface_theme()
|
||||||
return getattr(theme, setting)
|
return getattr(theme, setting)
|
||||||
|
|
||||||
|
|
||||||
@simple_tag()
|
@register.simple_tag()
|
||||||
def get_admin_interface_inline_template(template):
|
def get_admin_interface_inline_template(template):
|
||||||
template_path = template.split("/")
|
template_path = template.split("/")
|
||||||
template_path[-1] = "headerless_" + template_path[-1]
|
template_path[-1] = "headerless_" + template_path[-1]
|
||||||
return "/".join(template_path)
|
return "/".join(template_path)
|
||||||
|
|
||||||
|
|
||||||
@simple_tag(takes_context=False)
|
@register.simple_tag()
|
||||||
def get_admin_interface_version():
|
def get_admin_interface_version():
|
||||||
return __version__
|
return __version__
|
||||||
|
|
||||||
|
|
@ -98,17 +90,17 @@ def hash_string(text):
|
||||||
return sha224_hash
|
return sha224_hash
|
||||||
|
|
||||||
|
|
||||||
@simple_tag(takes_context=False)
|
@register.simple_tag()
|
||||||
def get_admin_interface_nocache():
|
def get_admin_interface_nocache():
|
||||||
return hash_string(__version__)
|
return hash_string(__version__)
|
||||||
|
|
||||||
|
|
||||||
@simple_tag()
|
@register.simple_tag()
|
||||||
def admin_interface_clear_filter_qs(changelist, list_filter):
|
def admin_interface_clear_filter_qs(changelist, list_filter):
|
||||||
return changelist.get_query_string(remove=list_filter.expected_parameters())
|
return changelist.get_query_string(remove=list_filter.expected_parameters())
|
||||||
|
|
||||||
|
|
||||||
@simple_tag()
|
@register.simple_tag()
|
||||||
def admin_interface_filter_removal_link(changelist, list_filter):
|
def admin_interface_filter_removal_link(changelist, list_filter):
|
||||||
template = get_template("admin_interface/list_filter_removal_link.html")
|
template = get_template("admin_interface/list_filter_removal_link.html")
|
||||||
title = list_filter.title
|
title = list_filter.title
|
||||||
|
|
@ -130,7 +122,7 @@ def admin_interface_filter_removal_link(changelist, list_filter):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@simple_tag()
|
@register.simple_tag()
|
||||||
def admin_interface_use_changeform_tabs(adminform, inline_forms):
|
def admin_interface_use_changeform_tabs(adminform, inline_forms):
|
||||||
theme = get_admin_interface_theme()
|
theme = get_admin_interface_theme()
|
||||||
has_fieldset_tabs = theme.show_fieldsets_as_tabs and len(adminform.fieldsets) > 1
|
has_fieldset_tabs = theme.show_fieldsets_as_tabs and len(adminform.fieldsets) > 1
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
__version__ = "0.23.0"
|
__version__ = "0.23.0"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
|
||||||
23
setup.py
23
setup.py
|
|
@ -1,6 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
@ -18,10 +16,7 @@ long_description_file_path = os.path.join(package_path, "README.md")
|
||||||
long_description_content_type = "text/markdown"
|
long_description_content_type = "text/markdown"
|
||||||
long_description = ""
|
long_description = ""
|
||||||
try:
|
try:
|
||||||
long_description_file_options = (
|
with open(long_description_file_path, "r", encoding="utf-8") as f:
|
||||||
{} if sys.version_info[0] < 3 else {"encoding": "utf-8"}
|
|
||||||
)
|
|
||||||
with open(long_description_file_path, "r", **long_description_file_options) as f:
|
|
||||||
long_description = f.read()
|
long_description = f.read()
|
||||||
except IOError:
|
except IOError:
|
||||||
pass
|
pass
|
||||||
|
|
@ -54,7 +49,6 @@ setup(
|
||||||
"custom",
|
"custom",
|
||||||
"ui",
|
"ui",
|
||||||
],
|
],
|
||||||
requires=["django(>=1.7)"],
|
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"django-colorfield >= 0.2, < 1.0",
|
"django-colorfield >= 0.2, < 1.0",
|
||||||
"django-flat-theme >= 1.0, < 2.0",
|
"django-flat-theme >= 1.0, < 2.0",
|
||||||
|
|
@ -65,13 +59,6 @@ setup(
|
||||||
"Development Status :: 5 - Production/Stable",
|
"Development Status :: 5 - Production/Stable",
|
||||||
"Environment :: Web Environment",
|
"Environment :: Web Environment",
|
||||||
"Framework :: Django",
|
"Framework :: Django",
|
||||||
"Framework :: Django :: 1.7",
|
|
||||||
"Framework :: Django :: 1.8",
|
|
||||||
"Framework :: Django :: 1.9",
|
|
||||||
"Framework :: Django :: 1.10",
|
|
||||||
"Framework :: Django :: 1.11",
|
|
||||||
"Framework :: Django :: 2.0",
|
|
||||||
"Framework :: Django :: 2.1",
|
|
||||||
"Framework :: Django :: 2.2",
|
"Framework :: Django :: 2.2",
|
||||||
"Framework :: Django :: 3.0",
|
"Framework :: Django :: 3.0",
|
||||||
"Framework :: Django :: 3.1",
|
"Framework :: Django :: 3.1",
|
||||||
|
|
@ -82,19 +69,13 @@ setup(
|
||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
"Natural Language :: English",
|
"Natural Language :: English",
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
"Programming Language :: Python :: 2",
|
|
||||||
"Programming Language :: Python :: 2.7",
|
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.4",
|
"Programming Language :: Python :: 3 :: Only",
|
||||||
"Programming Language :: Python :: 3.5",
|
|
||||||
"Programming Language :: Python :: 3.6",
|
|
||||||
"Programming Language :: Python :: 3.7",
|
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
"Programming Language :: Python :: 3.9",
|
"Programming Language :: Python :: 3.9",
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
"Topic :: Software Development :: Build Tools",
|
"Topic :: Software Development :: Build Tools",
|
||||||
],
|
],
|
||||||
license="MIT",
|
|
||||||
test_suite="runtests.runtests",
|
test_suite="runtests.runtests",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import django
|
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
SECRET_KEY = "django-admin-interface"
|
SECRET_KEY = "django-admin-interface"
|
||||||
|
|
@ -18,17 +12,6 @@ INSTALLED_APPS = [
|
||||||
"colorfield",
|
"colorfield",
|
||||||
]
|
]
|
||||||
|
|
||||||
if django.VERSION < (1, 9):
|
|
||||||
# ONLY if django version < 1.9
|
|
||||||
INSTALLED_APPS += [
|
|
||||||
"flat",
|
|
||||||
]
|
|
||||||
|
|
||||||
if django.VERSION < (2, 0):
|
|
||||||
# ONLY if django version < 2.0
|
|
||||||
INSTALLED_APPS += [
|
|
||||||
"flat_responsive",
|
|
||||||
]
|
|
||||||
|
|
||||||
INSTALLED_APPS += [
|
INSTALLED_APPS += [
|
||||||
"django.contrib.admin",
|
"django.contrib.admin",
|
||||||
|
|
@ -38,20 +21,12 @@ INSTALLED_APPS += [
|
||||||
"django.contrib.sessions",
|
"django.contrib.sessions",
|
||||||
]
|
]
|
||||||
|
|
||||||
if django.VERSION < (2, 0):
|
MIDDLEWARE = [
|
||||||
MIDDLEWARE_CLASSES = [
|
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
"django.contrib.messages.middleware.MessageMiddleware",
|
||||||
"django.contrib.messages.middleware.MessageMiddleware",
|
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
"django.middleware.common.CommonMiddleware",
|
||||||
"django.middleware.common.CommonMiddleware",
|
]
|
||||||
]
|
|
||||||
else:
|
|
||||||
MIDDLEWARE = [
|
|
||||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
||||||
"django.contrib.messages.middleware.MessageMiddleware",
|
|
||||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
|
||||||
"django.middleware.common.CommonMiddleware",
|
|
||||||
]
|
|
||||||
|
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import random
|
import random
|
||||||
import shutil
|
import shutil
|
||||||
from unittest import expectedFailure
|
from unittest import expectedFailure
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
from unittest import skipIf
|
from unittest import skipIf
|
||||||
|
|
||||||
from django import VERSION
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from admin_interface.models import Theme
|
from admin_interface.models import Theme
|
||||||
|
|
@ -24,9 +23,6 @@ class AdminInterfaceModelsWithDBRoutingTestCase(TestCase):
|
||||||
db_for_theme = router.db_for_read(Theme)
|
db_for_theme = router.db_for_read(Theme)
|
||||||
assert db_for_theme == "replica"
|
assert db_for_theme == "replica"
|
||||||
|
|
||||||
@skipIf(
|
|
||||||
VERSION[0] < 2, "TestCase does not respect database param on older versions"
|
|
||||||
)
|
|
||||||
def test_dbrouter_errors_when_fetching_from_default(self):
|
def test_dbrouter_errors_when_fetching_from_default(self):
|
||||||
with self.assertRaises(Exception):
|
with self.assertRaises(Exception):
|
||||||
Theme.get_active_theme()
|
Theme.get_active_theme()
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import django
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
|
|
@ -27,24 +22,10 @@ class AdminInterfaceSettingsTestCase(TestCase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __test_installed_apps(self):
|
def __test_installed_apps(self):
|
||||||
dj_version = django.VERSION
|
|
||||||
installed_apps = settings.INSTALLED_APPS
|
installed_apps = settings.INSTALLED_APPS
|
||||||
|
|
||||||
if "colorfield" not in installed_apps:
|
if "colorfield" not in installed_apps:
|
||||||
self.assertRaises(ImproperlyConfigured, check_installed_apps)
|
self.assertRaises(ImproperlyConfigured, check_installed_apps)
|
||||||
|
|
||||||
elif "flat" not in installed_apps and dj_version < (1, 9):
|
|
||||||
self.assertRaises(ImproperlyConfigured, check_installed_apps)
|
|
||||||
|
|
||||||
elif "flat" in installed_apps and dj_version >= (1, 9):
|
|
||||||
self.assertRaises(ImproperlyConfigured, check_installed_apps)
|
|
||||||
|
|
||||||
elif "flat_responsive" not in installed_apps and dj_version < (2, 0):
|
|
||||||
self.assertRaises(ImproperlyConfigured, check_installed_apps)
|
|
||||||
|
|
||||||
elif "flat_responsive" in installed_apps and dj_version >= (2, 0):
|
|
||||||
self.assertRaises(ImproperlyConfigured, check_installed_apps)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
check_installed_apps()
|
check_installed_apps()
|
||||||
|
|
||||||
|
|
@ -52,8 +33,6 @@ class AdminInterfaceSettingsTestCase(TestCase):
|
||||||
INSTALLED_APPS=[
|
INSTALLED_APPS=[
|
||||||
"admin_interface",
|
"admin_interface",
|
||||||
"colorfield",
|
"colorfield",
|
||||||
"flat",
|
|
||||||
"flat_responsive",
|
|
||||||
]
|
]
|
||||||
+ DJANGO_APPS
|
+ DJANGO_APPS
|
||||||
)
|
)
|
||||||
|
|
@ -64,34 +43,8 @@ class AdminInterfaceSettingsTestCase(TestCase):
|
||||||
INSTALLED_APPS=[
|
INSTALLED_APPS=[
|
||||||
"admin_interface",
|
"admin_interface",
|
||||||
# 'colorfield',
|
# 'colorfield',
|
||||||
"flat",
|
|
||||||
"flat_responsive",
|
|
||||||
]
|
]
|
||||||
+ DJANGO_APPS
|
+ DJANGO_APPS
|
||||||
)
|
)
|
||||||
def test_installed_apps_no_colorfield(self):
|
def test_installed_apps_no_colorfield(self):
|
||||||
self.__test_installed_apps()
|
self.__test_installed_apps()
|
||||||
|
|
||||||
@override_settings(
|
|
||||||
INSTALLED_APPS=[
|
|
||||||
"admin_interface",
|
|
||||||
"colorfield",
|
|
||||||
# 'flat',
|
|
||||||
"flat_responsive",
|
|
||||||
]
|
|
||||||
+ DJANGO_APPS
|
|
||||||
)
|
|
||||||
def test_installed_apps_no_flat(self):
|
|
||||||
self.__test_installed_apps()
|
|
||||||
|
|
||||||
@override_settings(
|
|
||||||
INSTALLED_APPS=[
|
|
||||||
"admin_interface",
|
|
||||||
"colorfield",
|
|
||||||
"flat",
|
|
||||||
# 'flat_responsive',
|
|
||||||
]
|
|
||||||
+ DJANGO_APPS
|
|
||||||
)
|
|
||||||
def test_installed_apps_no_flat_responsive(self):
|
|
||||||
self.__test_installed_apps()
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.template import Context, Template
|
from django.template import Context, Template
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
from django.test.client import RequestFactory
|
from django.test.client import RequestFactory
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import django
|
|
||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
if django.VERSION < (2, 0):
|
|
||||||
from django.conf.urls import include
|
|
||||||
from django.conf.urls import url as re_path
|
|
||||||
else:
|
|
||||||
from django.urls import include, re_path
|
|
||||||
|
|
||||||
from django.conf.urls.i18n import i18n_patterns
|
from django.conf.urls.i18n import i18n_patterns
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import include, path
|
||||||
|
|
||||||
urlpatterns = []
|
urlpatterns = []
|
||||||
urlpatterns += [
|
urlpatterns += [
|
||||||
re_path(r"^i18n/", include("django.conf.urls.i18n")),
|
path("i18n/", include("django.conf.urls.i18n")),
|
||||||
]
|
]
|
||||||
urlpatterns += i18n_patterns(
|
urlpatterns += i18n_patterns(
|
||||||
re_path(r"^admin/", admin.site.urls),
|
path("admin/", admin.site.urls),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import django
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.urls import path
|
||||||
if django.VERSION < (2, 0):
|
|
||||||
from django.conf.urls import url as re_path
|
|
||||||
else:
|
|
||||||
from django.urls import re_path
|
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
re_path(r"^admin/", admin.site.urls),
|
path("admin/", admin.site.urls),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
13
tox.ini
13
tox.ini
|
|
@ -1,8 +1,5 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist =
|
envlist =
|
||||||
py27-{dj17,dj18,dj19,dj110,dj111}-{sqlite,postgres},
|
|
||||||
py36-{dj18,dj19,dj110,dj111,dj20,dj21,dj22,dj30,dj31,dj32}-{sqlite,postgres},
|
|
||||||
py37-{dj20,dj21,dj22,dj30,dj31,dj32}-{sqlite,postgres},
|
|
||||||
py38-{dj22,dj30,dj31,dj32}-{sqlite,postgres},
|
py38-{dj22,dj30,dj31,dj32}-{sqlite,postgres},
|
||||||
py39-{dj22,dj30,dj31,dj32}-{sqlite,postgres},
|
py39-{dj22,dj30,dj31,dj32}-{sqlite,postgres},
|
||||||
py310-{dj32,dj40,dj41}-{sqlite,postgres},
|
py310-{dj32,dj40,dj41}-{sqlite,postgres},
|
||||||
|
|
@ -10,9 +7,6 @@ envlist =
|
||||||
|
|
||||||
[gh-actions]
|
[gh-actions]
|
||||||
python =
|
python =
|
||||||
2.7: py27
|
|
||||||
3.6: py36
|
|
||||||
3.7: py37
|
|
||||||
3.8: py38
|
3.8: py38
|
||||||
3.9: py39
|
3.9: py39
|
||||||
3.10: py310
|
3.10: py310
|
||||||
|
|
@ -21,13 +15,6 @@ python =
|
||||||
[testenv]
|
[testenv]
|
||||||
passenv = CI GITHUB_WORKFLOW
|
passenv = CI GITHUB_WORKFLOW
|
||||||
deps =
|
deps =
|
||||||
dj17: Django == 1.7.*
|
|
||||||
dj18: Django == 1.8.*
|
|
||||||
dj19: Django == 1.9.*
|
|
||||||
dj110: Django == 1.10.*
|
|
||||||
dj111: Django == 1.11.*
|
|
||||||
dj20: Django == 2.0.*
|
|
||||||
dj21: Django == 2.1.*
|
|
||||||
dj22: Django == 2.2.*
|
dj22: Django == 2.2.*
|
||||||
dj30: Django == 3.0.*
|
dj30: Django == 3.0.*
|
||||||
dj31: Django == 3.1.*
|
dj31: Django == 3.1.*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue