mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 11:51:05 -05:00
Django 1.8 alpha 1 support
* Test on Python 2.7, 3.4, pypy. * Call super.setUpClass in DjrillAdminTests. https://docs.djangoproject.com/en/dev/releases/1.8/#overriding-setupclass-teardownclass-in-test-cases Also clear up some new PendingDeprecationWarnings, where the changes can easily remain compatible back to Django 1.3: * Remove deprecated django.conf.urls.patterns. (And match Django recommendations in our docs.) https://docs.djangoproject.com/en/dev/releases/1.8/#django-conf-urls-patterns * Remove deprecated SimpleTestCase.urls. (We've already back-ported @override_settings for testing older Django versions.) https://docs.djangoproject.com/en/dev/releases/1.8/#django-test-simpletestcase-urls
This commit is contained in:
10
.travis.yml
10
.travis.yml
@@ -38,9 +38,13 @@ matrix:
|
||||
env: DJANGO=django==1.7
|
||||
- python: "pypy"
|
||||
env: DJANGO=django==1.7
|
||||
# Django 1.8beta: tbd...
|
||||
# - python: "2.7"
|
||||
# env: DJANGO=https://www.djangoproject.com/download/1.8b1/tarball/
|
||||
# Django 1.8alpha: "Python 2.7 or above"
|
||||
- python: "2.7"
|
||||
env: DJANGO=https://www.djangoproject.com/download/1.8a1/tarball/
|
||||
- python: "3.4"
|
||||
env: DJANGO=https://www.djangoproject.com/download/1.8a1/tarball/
|
||||
- python: "pypy"
|
||||
env: DJANGO=https://www.djangoproject.com/download/1.8a1/tarball/
|
||||
install:
|
||||
- pip install -q $DJANGO
|
||||
- pip install .
|
||||
|
||||
@@ -30,8 +30,8 @@ package. It includes:
|
||||
via Django signals
|
||||
* An optional Django admin interface
|
||||
|
||||
Djrill is released under the BSD license. It is tested against Django 1.3---1.7
|
||||
(including Python 3 and PyPy support with Django 1.5+).
|
||||
Djrill is released under the BSD license. It is tested against Django 1.3--1.8
|
||||
(including Python 3 with Django 1.6+, and PyPy support with Django 1.5+).
|
||||
|
||||
.. END shared-intro
|
||||
|
||||
|
||||
@@ -39,19 +39,19 @@ class DjrillAdminSite(AdminSite):
|
||||
"""Add our custom views to the admin urlconf."""
|
||||
urls = super(DjrillAdminSite, self).get_urls()
|
||||
try:
|
||||
from django.conf.urls import include, patterns, url
|
||||
from django.conf.urls import include, url
|
||||
except ImportError:
|
||||
# Django 1.3
|
||||
#noinspection PyDeprecation
|
||||
from django.conf.urls.defaults import include, patterns, url
|
||||
from django.conf.urls.defaults import include, url
|
||||
for path, view, name, display_name in self.custom_views:
|
||||
urls += patterns('',
|
||||
url(r'^%s$' % path, self.admin_view(view), name=name),
|
||||
)
|
||||
urls += [
|
||||
url(r'^%s$' % path, self.admin_view(view), name=name)
|
||||
]
|
||||
for path, view, name in self.custom_urls:
|
||||
urls += patterns('',
|
||||
url(r'^%s$' % path, self.admin_view(view), name=name),
|
||||
)
|
||||
urls += [
|
||||
url(r'^%s$' % path, self.admin_view(view), name=name)
|
||||
]
|
||||
|
||||
return urls
|
||||
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
try:
|
||||
from django.conf.urls import include, patterns, url
|
||||
from django.conf.urls import include, url
|
||||
except ImportError:
|
||||
# Django 1.3
|
||||
from django.conf.urls.defaults import include, patterns, url
|
||||
from django.conf.urls.defaults import include, url
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
from djrill import DjrillAdminSite
|
||||
|
||||
# Set up the DjrillAdminSite as suggested in the docs
|
||||
|
||||
admin.site = DjrillAdminSite()
|
||||
admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = [
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
)
|
||||
]
|
||||
|
||||
@@ -7,6 +7,8 @@ import six
|
||||
|
||||
from djrill.tests.mock_backend import DjrillBackendMockAPITestCase
|
||||
|
||||
from .utils import override_settings
|
||||
|
||||
|
||||
def reset_admin_site():
|
||||
"""Return the Django admin globals to their original state"""
|
||||
@@ -15,14 +17,13 @@ def reset_admin_site():
|
||||
del sys.modules['djrill.admin'] # force autodiscover to re-import
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF='djrill.tests.admin_urls')
|
||||
class DjrillAdminTests(DjrillBackendMockAPITestCase):
|
||||
"""Test the Djrill admin site"""
|
||||
|
||||
# These urls set up the DjrillAdminSite as suggested in the readme
|
||||
urls = 'djrill.tests.admin_urls'
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(DjrillAdminTests, cls).setUpClass()
|
||||
# Other test cases may muck with the Django admin site globals,
|
||||
# so return it to the default state before loading test_admin_urls
|
||||
reset_admin_site()
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
try:
|
||||
from django.conf.urls import patterns, url
|
||||
from django.conf.urls import url
|
||||
except ImportError:
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
from django.conf.urls.defaults import url
|
||||
|
||||
from .views import DjrillWebhookView
|
||||
|
||||
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^webhook/$', DjrillWebhookView.as_view(), name='djrill_webhook'),
|
||||
)
|
||||
]
|
||||
|
||||
@@ -3,6 +3,7 @@ Release Notes
|
||||
|
||||
Version 1.4 (development):
|
||||
|
||||
* Django 1.8 alpha support
|
||||
|
||||
|
||||
Version 1.3:
|
||||
|
||||
@@ -84,10 +84,10 @@ If you want to enable the Djrill admin interface, edit your base :file:`urls.py`
|
||||
admin.autodiscover()
|
||||
...
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = [
|
||||
...
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
)
|
||||
]
|
||||
|
||||
If you are on **Django 1.7 or later,** you will also need to change the config used
|
||||
by the django.contrib.admin app in your :file:`settings.py`:
|
||||
|
||||
Reference in New Issue
Block a user