update for Django 1.10

This commit is contained in:
Benjamin Dauvergne 2017-03-10 18:38:44 +01:00
parent cc83abb261
commit 91cdece1e1
6 changed files with 53 additions and 15 deletions

View File

@ -24,6 +24,7 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
from itertools import chain
from django.conf import global_settings
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
@ -72,7 +73,8 @@ MIDDLEWARE_CLASSES = (
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
STATICFILES_FINDERS = global_settings.STATICFILES_FINDERS + ('gadjo.finders.XStaticFinder',)
STATICFILES_FINDERS = list(chain(global_settings.STATICFILES_FINDERS,
('gadjo.finders.XStaticFinder',)))
ROOT_URLCONF = 'bijoe.urls'
@ -137,6 +139,27 @@ LOGGING = {
},
}
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
# insert your TEMPLATE_DIRS here
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
],
},
},
]
# Django-Select2
AUTO_RENDER_SELECT2_STATICS = False

View File

@ -14,21 +14,26 @@
# 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/>.
from django.conf.urls import patterns, include, url
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
import views
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^$', views.homepage, name='homepage'),
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/login/$', views.login, name='login'),
url(r'^accounts/logout/$', views.logout, name='logout'),
url(r'^manage/menu.json$', views.menu_json, name='menu-json'),
url(r'^visualization/', include('bijoe.visualization.urls')),
)
]
if 'mellon' in settings.INSTALLED_APPS:
urlpatterns += patterns('', url(r'^accounts/mellon/', include('mellon.urls')))
urlpatterns += [url(r'^accounts/mellon/', include('mellon.urls'))]
# Django <1.9 compatibility
import django
if django.VERSION < (1, 9):
from django.conf.urls import patterns
urlpatterns = patterns('', *urlpatterns)

View File

@ -14,12 +14,11 @@
# 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/>.
from django.conf.urls import patterns, url
from django.conf.urls import url
from . import views
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^$',
views.visualizations, name='visualizations'),
url(r'^json/$',
@ -35,4 +34,11 @@ urlpatterns = patterns(
url(r'(?P<pk>\d+)/iframe/$', views.visualization_iframe, name='visualization-iframe'),
url(r'(?P<pk>\d+)/rename/$', views.rename_visualization, name='rename-visualization'),
url(r'(?P<pk>\d+)/delete/$', views.visualization, name='delete-visualization'),
)
]
# Django <1.9 compatibility
import django
if django.VERSION < (1, 9):
from django.conf.urls import patterns
urlpatterns = patterns('', *urlpatterns)

View File

@ -6,4 +6,4 @@ rm -f coverage.xml
rm -f test_results.xml
pip install --upgrade tox
tox -r -e coverage
tox -r -e coverage-{dj17,dj18,dj19,dj110}

View File

@ -92,8 +92,8 @@ setup(name="bijoe",
maintainer_email="bdauvergne@entrouvert.com",
packages=find_packages(),
include_package_data=True,
install_requires=['requests', 'django', 'psycopg2', 'isodate', 'Django-Select2<5',
'XStatic-ChartNew.js', 'gadjo', 'django-jsonfield<1.0.0',
install_requires=['requests', 'django', 'psycopg2', 'isodate', 'Django-Select2',
'XStatic-ChartNew.js', 'gadjo', 'django-jsonfield',
'python-dateutil', 'djangorestframework<3.4'],
scripts=['bijoe-ctl'],
cmdclass={

View File

@ -5,7 +5,7 @@
[tox]
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/bijoe/
envlist = dj17,dj18
envlist = dj17,dj18,dj110
[testenv]
usedevelop = true
@ -15,8 +15,12 @@ setenv =
deps =
dj17: django>=1.7,<1.8
dj18: django>=1.8,<1.9
dj19: django>=1.9,<1.10
dj19: django>=1.9,<1.10 # unsupported
dj110: django>=1.10,<1.11
dj111: django>=1.11,<1.12
dj17: django-jsonfield<1.0
dj17: Django-Select2<5
dj18,dj19,dj110: Django-Select2>=5
coverage
pytest
pytest-cov