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

add django 1.10 support #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions ajaximage/urls.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
try: # pre 1.6
from django.conf.urls.defaults import url, patterns
except ImportError:
from django.conf.urls import url, patterns
try:
from django.conf.urls import url, patterns
urlpatterns = patterns(
'',
url(
'^upload/(?P<upload_to>.*)/(?P<max_width>\d+)/(?P<max_height>\d+)/(?P<crop>\d+)',
'ajaximage.views.ajaximage',
name='ajaximage'
),
)
except ImportError:
# django 1.10
from django.conf.urls import url
from ajaximage.views import ajaximage
urlpatterns = [
url(
'^upload/(?P<upload_to>.*)/(?P<max_width>\d+)/(?P<max_height>\d+)/(?P<crop>\d+)',
ajaximage,
name='ajaximage'
),
]

urlpatterns = patterns(
'',
url(
'^upload/(?P<upload_to>.*)/(?P<max_width>\d+)/(?P<max_height>\d+)/(?P<crop>\d+)',
'ajaximage.views.ajaximage',
name='ajaximage'
),
)
18 changes: 18 additions & 0 deletions example/example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,23 @@

TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'templates'),)

# django 1.10
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]


AJAXIMAGE_DIR = 'ajaximage/'
AJAXIMAGE_AUTH_TEST = lambda u: True
24 changes: 17 additions & 7 deletions example/example/urls.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
from django.conf.urls import patterns, include, url

from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin


admin.autodiscover()


urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^ajaximage/', include('ajaximage.urls')),
url(r'^form/', include('kitten.urls')),
)
try:
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^ajaximage/', include('ajaximage.urls')),
url(r'^form/', include('kitten.urls')),
)
except ImportError:
# django 1.10
from django.conf.urls import include, url
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^ajaximage/', include('ajaximage.urls')),
url(r'^form/', include('kitten.urls')),
]


urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
17 changes: 11 additions & 6 deletions example/kitten/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
from django.conf.urls import patterns, url

from .views import MyView


urlpatterns = patterns('',
url('', MyView.as_view(), name='form'),
)
try:
from django.conf.urls import patterns, url
urlpatterns = patterns('',
url('', MyView.as_view(), name='form'),
)
except ImportError:
# django 1.10
from django.conf.urls import url
urlpatterns = [
url('', MyView.as_view(), name='form'),
]