Skip to content

Commit 7feb0f8

Browse files
committed
Remove Django 1.7, 1.8, 1.9, 1.10 compatibility code
1 parent c47b705 commit 7feb0f8

File tree

11 files changed

+76
-380
lines changed

11 files changed

+76
-380
lines changed

.travis.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,19 @@ language: python
33
cache: pip
44
python:
55
- "2.7"
6-
- "3.4"
76
- "3.6"
87
env:
9-
- PACKAGES="Django>=1.7,<1.8 django-contrib-comments<1.8"
10-
- PACKAGES="Django>=1.8,<1.9"
11-
- PACKAGES="Django>=1.9,<1.10"
12-
- PACKAGES="Django>=1.10,<1.11"
138
- PACKAGES="Django>=1.11,<1.12"
149
- PACKAGES="Django>=2.0,<2.1"
10+
- PACKAGES="Django>=2.1,<2.2"
1511
matrix:
1612
exclude:
17-
- python: '3.6'
18-
env: PACKAGES="Django>=1.7,<1.8 django-contrib-comments<1.8"
1913
- python: '2.7'
2014
env: PACKAGES="Django>=2.0,<2.1"
15+
- python: '2.7'
16+
env: PACKAGES="Django>=2.1,<2.2"
2117
allow_failure:
22-
- env: PACKAGES="Django>=2.0,<2.1"
18+
- env: PACKAGES="Django>=2.1,<2.2"
2319

2420
before_install:
2521
- pip install codecov

runtests.py

Lines changed: 21 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,54 +15,24 @@
1515
)
1616

1717
if not settings.configured:
18-
if django.VERSION >= (1,8):
19-
base_app = 'django_comments'
20-
21-
versioned_settings = dict(
22-
TEMPLATES = [
23-
{
24-
'BACKEND': 'django.template.backends.django.DjangoTemplates',
25-
'APP_DIRS': True,
26-
'OPTIONS': {
27-
'context_processors': [
28-
'django.contrib.auth.context_processors.auth',
29-
'django.template.context_processors.request',
30-
'django.template.context_processors.static',
31-
'django.contrib.messages.context_processors.messages',
32-
]
33-
},
34-
},
35-
]
36-
)
37-
else:
38-
base_app = 'django.contrib.comments'
39-
versioned_settings = dict(
40-
TEMPLATE_LOADERS = (
41-
'django.template.loaders.app_directories.Loader',
42-
),
43-
TEMPLATE_CONTEXT_PROCESSORS = list(default_settings.TEMPLATE_CONTEXT_PROCESSORS) + [
44-
'django.core.context_processors.request',
45-
],
46-
)
47-
4818
if django.VERSION >= (2, 0):
49-
versioned_settings.update(dict(
19+
versioned_settings = dict(
5020
MIDDLEWARE = (
5121
'django.middleware.common.CommonMiddleware',
5222
'django.contrib.sessions.middleware.SessionMiddleware',
5323
'django.middleware.csrf.CsrfViewMiddleware',
5424
'django.contrib.auth.middleware.AuthenticationMiddleware',
5525
)
56-
))
26+
)
5727
else:
58-
versioned_settings.update(dict(
28+
versioned_settings = dict(
5929
MIDDLEWARE_CLASSES = (
6030
'django.middleware.common.CommonMiddleware',
6131
'django.contrib.sessions.middleware.SessionMiddleware',
6232
'django.middleware.csrf.CsrfViewMiddleware',
6333
'django.contrib.auth.middleware.AuthenticationMiddleware',
6434
)
65-
))
35+
)
6636

6737
settings.configure(
6838
DATABASES = {
@@ -76,19 +46,31 @@
7646
'django.contrib.messages',
7747
'django.contrib.sites',
7848
'django.contrib.admin',
79-
base_app,
49+
'django_comments',
8050
'threadedcomments',
8151
),
82-
ROOT_URLCONF = '{0}.urls'.format(base_app),
83-
TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner' if django.VERSION < (1,6) else 'django.test.runner.DiscoverRunner',
52+
TEMPLATES = [
53+
{
54+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
55+
'APP_DIRS': True,
56+
'OPTIONS': {
57+
'context_processors': [
58+
'django.contrib.auth.context_processors.auth',
59+
'django.template.context_processors.request',
60+
'django.template.context_processors.static',
61+
'django.contrib.messages.context_processors.messages',
62+
]
63+
},
64+
},
65+
],
66+
ROOT_URLCONF = 'django_comments.urls',
67+
TEST_RUNNER = 'django.test.runner.DiscoverRunner',
8468
SITE_ID = 1,
8569
COMMENTS_APP = 'threadedcomments',
8670
COMMENTS_ALLOW_PROFANITIES = True,
8771
**versioned_settings
8872
)
8973

90-
sys.stderr.write('Using comments app {0} from {1}\n'.format(base_app, path.dirname(import_module(base_app).__file__)))
91-
9274
def runtests():
9375
argv = sys.argv[:1] + ['test', 'threadedcomments', '--traceback'] + sys.argv[1:]
9476
execute_from_command_line(argv)

setup.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def find_version(*parts):
3838
version=find_version('threadedcomments', '__init__.py'),
3939
license='BSD',
4040
install_requires=[
41-
'django-contrib-comments>=1.7.3',
41+
'django-contrib-comments>=1.9.0',
4242
],
4343

4444
description='A simple yet flexible threaded commenting system.',
@@ -74,12 +74,9 @@ def find_version(*parts):
7474
'Programming Language :: Python :: 3.5',
7575
'Programming Language :: Python :: 3.6',
7676
'Framework :: Django',
77-
'Framework :: Django :: 1.7',
78-
'Framework :: Django :: 1.8',
79-
'Framework :: Django :: 1.9',
80-
'Framework :: Django :: 1.10',
8177
'Framework :: Django :: 1.11',
8278
'Framework :: Django :: 2.0',
79+
'Framework :: Django :: 2.1',
8380
'Topic :: Internet :: WWW/HTTP',
8481
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
8582
'Topic :: Software Development :: Libraries :: Python Modules',

threadedcomments/admin.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
11
from django.contrib import admin
22
from django.utils.translation import ugettext_lazy as _
3+
from django_comments.admin import CommentsAdmin
34

4-
from .compat import BASE_APP
55
from .models import ThreadedComment
66

7-
# This code is not in the .compat module to avoid admin imports in all other code.
8-
# The admin import usually starts a model registration too, hence keep these imports here.
9-
10-
if BASE_APP == 'django.contrib.comments':
11-
# Django 1.7 and below
12-
from django.contrib.comments.admin import CommentsAdmin
13-
elif BASE_APP == 'django_comments':
14-
# Django 1.8 and up
15-
from django_comments.admin import CommentsAdmin
16-
else:
17-
raise NotImplementedError()
18-
197

208
class ThreadedCommentsAdmin(CommentsAdmin):
219
fieldsets = (

threadedcomments/compat.py

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)