Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django 1.10 support #276

Merged
merged 10 commits into from Oct 17, 2016
36 changes: 28 additions & 8 deletions .travis.yml
Expand Up @@ -6,25 +6,45 @@ python:
- "3.4"
- "3.5"
env:
- DJANGO_VERSION=1.8 TESTDB=sqlite
- DJANGO_VERSION=1.8 TESTDB=postgres
- DJANGO_VERSION=1.9 TESTDB=sqlite
- DJANGO_VERSION=1.9 TESTDB=postgres
- DJANGO='django>=1.8.0,<1.9.0' TESTDB=sqlite
- DJANGO='django>=1.8.0,<1.9.0' TESTDB=postgres
- DJANGO='django>=1.9.0,<1.10.0' TESTDB=sqlite
- DJANGO='django>=1.9.0,<1.10.0' TESTDB=postgres
- DJANGO='django>=1.10.0,<1.11.0' TESTDB=sqlite
- DJANGO='django>=1.10.0,<1.11.0' TESTDB=postgres
- DJANGO='https://github.com/django/django/archive/master.tar.gz' TESTDB=sqlite
- DJANGO='https://github.com/django/django/archive/master.tar.gz' TESTDB=postgres

matrix:
exclude:
# Django 1.9 doesn't support 3.3
# Django no longer supports 3.3
- python: "3.3"
env: DJANGO_VERSION=1.9 TESTDB=sqlite
env: DJANGO='django>=1.9.0,<1.10.0' TESTDB=sqlite
- python: "3.3"
env: DJANGO_VERSION=1.9 TESTDB=postgres
env: DJANGO='django>=1.9.0,<1.10.0' TESTDB=postgres
- python: "3.3"
env: DJANGO='django>=1.10.0,<1.11.0' TESTDB=sqlite
- python: "3.3"
env: DJANGO='django>=1.10.0,<1.11.0' TESTDB=postgres
- python: "3.3"

allow_failures:
- env: DJANGO='https://github.com/django/django/archive/master.tar.gz' TESTDB=postgres
- env: DJANGO='https://github.com/django/django/archive/master.tar.gz' TESTDB=sqlite

services:
- postgresql

cache:
directories:
- $HOME/.cache/pip

before_install:
- if [ "$TESTDB" = "postgres" ]; then pip install -q psycopg2 ; fi
# command to install dependencies,
install:
# Install the right version of Django first
- pip install 'Django~='"$DJANGO_VERSION".0
- pip install "$DJANGO"
- pip install -r requirements.txt -r requirements-dev.txt
# command to run tests
script: NOSE_WITH_COVERAGE=1 python manage.py test
7 changes: 3 additions & 4 deletions wafer/kv/urls.py
@@ -1,4 +1,4 @@
from django.conf.urls import patterns, url, include
from django.conf.urls import include, url

from rest_framework import routers

Expand All @@ -7,7 +7,6 @@
router = routers.DefaultRouter()
router.register(r'kv', KeyValueViewSet)

urlpatterns = patterns(
'',
urlpatterns = [
url(r'^api/', include(router.urls)),
)
]
15 changes: 9 additions & 6 deletions wafer/pages/urls.py
@@ -1,13 +1,16 @@
from django.conf.urls import patterns, url, include
from django.conf.urls import include, url
from django.core.urlresolvers import get_script_prefix
from django.views.generic import RedirectView
from rest_framework import routers

from wafer.pages.views import PageViewSet
from wafer.pages.views import PageViewSet, slug

router = routers.DefaultRouter()
router.register(r'pages', PageViewSet)

urlpatterns = patterns(
'wafer.pages.views',
urlpatterns = [
url(r'^api/', include(router.urls)),
url(r'^(?:(.+)/)?$', 'slug', name='wafer_page'),
)
url('^index(?:\.html)?/?$', RedirectView.as_view(
url=get_script_prefix(), permanent=True, query_string=True)),
url(r'^(?:(.+)/)?$', slug, name='wafer_page'),
]
3 changes: 2 additions & 1 deletion wafer/registration/forms.py
@@ -1,3 +1,4 @@
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _

Expand All @@ -14,7 +15,7 @@ def __init__(self, *args, **kwargs):


class LoginFormHelper(FormHelper):
form_action = reverse('django.contrib.auth.views.login')
form_action = settings.LOGIN_URL

def __init__(self, *args, **kwargs):
super(LoginFormHelper, self).__init__(*args, **kwargs)
Expand Down
16 changes: 9 additions & 7 deletions wafer/registration/urls.py
@@ -1,14 +1,16 @@
from django.conf.urls import include, patterns, url
from django.conf.urls import include, url
from django.views.generic import TemplateView

from registration.backends.default.views import ActivationView, RegistrationView

from wafer.registration.views import debian_login, github_login, redirect_profile


urlpatterns = patterns(
'wafer.registration.views',
url(r'^profile/$', 'redirect_profile'),
urlpatterns = [
url(r'^profile/$', redirect_profile),

url(r'^github-login/$', 'github_login'),
url(r'^debian-login/$', 'debian_login'),
url(r'^github-login/$', github_login),
url(r'^debian-login/$', debian_login),

# registration.backends.default.urls, but Django 1.5 compatible
url(r'^activate/complete/$',
Expand All @@ -33,4 +35,4 @@
template_name='registration/registration_closed.html'
), name='registration_disallowed'),
url(r'', include('registration.auth_urls')),
)
]
7 changes: 3 additions & 4 deletions wafer/schedule/urls.py
@@ -1,4 +1,4 @@
from django.conf.urls import include, patterns, url
from django.conf.urls import include, url
from rest_framework import routers


Expand All @@ -8,12 +8,11 @@
router = routers.DefaultRouter()
router.register(r'scheduleitems', ScheduleItemViewSet)

urlpatterns = patterns(
'',
urlpatterns = [
url(r'^$', ScheduleView.as_view(), name='wafer_full_schedule'),
url(r'^venue/(?P<pk>\d+)/$', VenueView.as_view(), name='wafer_venue'),
url(r'^current/$', CurrentView.as_view(), name='wafer_current'),
url(r'^pentabarf\.xml$', ScheduleXmlView.as_view(),
name='wafer_pentabarf_xml'),
url(r'^api/', include(router.urls)),
)
]
52 changes: 27 additions & 25 deletions wafer/settings.py
Expand Up @@ -93,12 +93,33 @@
# Make this unique, and don't share it with anybody.
SECRET_KEY = '8iysa30^no&oi5kv$k1w)#gsxzrylr-h6%)loz71expnbf7z%)'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
TEMPLATES = [
{
'APP_DIRS': True,
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': (
# Put strings here, like "/home/html/django_templates" or
# "C:/www/django/templates". Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
),
'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',
'wafer.context_processors.site_info',
'wafer.context_processors.navigation_info',
'wafer.context_processors.menu_info',
'wafer.context_processors.registration_settings'
)
}
},
]


MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
Expand All @@ -116,25 +137,6 @@
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'wafer.wsgi.application'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or
# "C:/www/django/templates". Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'wafer.context_processors.site_info',
'wafer.context_processors.navigation_info',
'wafer.context_processors.menu_info',
'wafer.context_processors.registration_settings',
)

INSTALLED_APPS = (
'django.contrib.auth',
Expand Down
7 changes: 3 additions & 4 deletions wafer/sponsors/urls.py
@@ -1,4 +1,4 @@
from django.conf.urls import patterns, url, include
from django.conf.urls import url, include
from rest_framework import routers

from wafer.sponsors.views import (
Expand All @@ -9,12 +9,11 @@
router.register(r'sponsors', SponsorViewSet)
router.register(r'packages', PackageViewSet)

urlpatterns = patterns(
'',
urlpatterns = [
url(r'^$', ShowSponsors.as_view(),
name='wafer_sponsors'),
url(r'^(?P<pk>\d+)/$', SponsorView.as_view(), name='wafer_sponsor'),
url(r'^packages/$', ShowPackages.as_view(),
name='wafer_sponsorship_packages'),
url(r'^api/', include(router.urls)),
)
]
7 changes: 3 additions & 4 deletions wafer/talks/urls.py
@@ -1,4 +1,4 @@
from django.conf.urls import patterns, url, include
from django.conf.urls import url, include
from rest_framework_extensions import routers

from wafer.talks.views import (
Expand All @@ -12,8 +12,7 @@
r'urls', TalkUrlsViewSet, base_name='talks-urls',
parents_query_lookups=['talk'])

urlpatterns = patterns(
'',
urlpatterns = [
url(r'^$', UsersTalks.as_view(), name='wafer_users_talks'),
url(r'^page/(?P<page>\d+)/$', UsersTalks.as_view(),
name='wafer_users_talks_page'),
Expand All @@ -25,4 +24,4 @@
name='wafer_talk_delete'),
url(r'^speakers/$', Speakers.as_view(), name='wafer_talks_speakers'),
url(r'^api/', include(router.urls)),
)
]
14 changes: 7 additions & 7 deletions wafer/tickets/urls.py
@@ -1,10 +1,10 @@
from django.conf.urls import patterns, url
from wafer.tickets.views import ClaimView
from django.conf.urls import url
from wafer.tickets.views import ClaimView, zapier_cancel_hook, zapier_guest_hook


urlpatterns = patterns(
'wafer.tickets.views',
urlpatterns = [
url(r'^claim/$', ClaimView.as_view(), name='wafer_ticket_claim'),
url(r'^zapier_guest_hook/$', 'zapier_guest_hook'),
url(r'^zapier_cancel_hook/$', 'zapier_cancel_hook'),
)
url(r'^zapier_guest_hook/$', zapier_guest_hook),
url(r'^zapier_cancel_hook/$', zapier_cancel_hook),
]

28 changes: 13 additions & 15 deletions wafer/urls.py
@@ -1,24 +1,22 @@
from django.conf.urls import include, patterns, url
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns(
'',

(r'^accounts/', include('wafer.registration.urls')),
(r'^users/', include('wafer.users.urls')),
(r'^talks/', include('wafer.talks.urls')),
(r'^sponsors/', include('wafer.sponsors.urls')),
(r'^pages/', include('wafer.pages.urls')),
(r'^admin/', include(admin.site.urls)),
(r'^markitup/', include('markitup.urls')),
(r'^schedule/', include('wafer.schedule.urls')),
(r'^tickets/', include('wafer.tickets.urls')),
(r'^kv/', include('wafer.kv.urls')),
)
urlpatterns = [
url(r'^accounts/', include('wafer.registration.urls')),
url(r'^users/', include('wafer.users.urls')),
url(r'^talks/', include('wafer.talks.urls')),
url(r'^sponsors/', include('wafer.sponsors.urls')),
url(r'^pages/', include('wafer.pages.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^markitup/', include('markitup.urls')),
url(r'^schedule/', include('wafer.schedule.urls')),
url(r'^tickets/', include('wafer.tickets.urls')),
url(r'^kv/', include('wafer.kv.urls')),
]

# Serve media
if settings.DEBUG:
Expand Down
7 changes: 3 additions & 4 deletions wafer/users/urls.py
@@ -1,4 +1,4 @@
from django.conf.urls import patterns, url, include
from django.conf.urls import include, url
from rest_framework import routers

from wafer.users.views import (UsersView, ProfileView, EditProfileView,
Expand All @@ -8,8 +8,7 @@
router = routers.DefaultRouter()
router.register(r'users', UserViewSet)

urlpatterns = patterns(
'',
urlpatterns = [
url(r'^$', UsersView.as_view(),
name='wafer_users'),
url(r'^api/', include(router.urls)),
Expand All @@ -25,4 +24,4 @@
url(r'^(?P<username>[\w.@+-]+)/register/$',
RegistrationView.as_view(),
name='wafer_register_view'),
)
]