Skip to content

Commit 11317fc

Browse files
committed
Dependency: django 1.1 -> 2.2
1 parent 4ab2cfd commit 11317fc

File tree

5 files changed

+36
-17
lines changed

5 files changed

+36
-17
lines changed

example/sample/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Create your views here.
22

33
from django.template import RequestContext
4-
from django.shortcuts import render_to_response
4+
from django.shortcuts import render
55

66
from example.sample import forms
77

88

99
def index(request):
1010
data = {'form': forms.SelectForm(), 'modelform': forms.ModelSelectForm()}
1111

12-
return render_to_response("multiselect/index.html", data, context_instance=RequestContext(request))
12+
return render(request, "multiselect/index.html", data)
1313

1414

1515
def index2(request):
1616
data = {'form': forms.SelectForm2(), 'modelform': forms.ModelSelectForm2()}
1717

18-
return render_to_response("multiselect/index.html", data, context_instance=RequestContext(request))
18+
return render(request, "multiselect/index.html", data)

example/settings.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import os
2+
from os.path import dirname, join, abspath
23

34
DEBUG = True
45
TEMPLATE_DEBUG = DEBUG
5-
PROJECT_DIR = os.path.dirname(__file__)
6+
PROJECT_DIR = dirname(__file__)
67

78
DATABASES = {
89
'default': {
@@ -13,12 +14,12 @@
1314

1415
TIME_ZONE = 'America/Chicago'
1516
STATIC_URL = '/static/'
16-
TEMPLATE_DIRS = (os.path.join(PROJECT_DIR, 'templates'), )
17-
STATIC_DIR = (os.path.join(PROJECT_DIR, 'static'), )
17+
TEMPLATE_DIRS = (join(PROJECT_DIR, 'templates'), )
18+
STATIC_DIR = (join(PROJECT_DIR, 'static'), )
1819
ADMIN_MEDIA_PREFIX = '/media/'
1920
SECRET_KEY = '-2cmgs7l$5grqwd!cyat6&6241^ah&rwn#ef5s_lm(1@0a4w&v'
2021

21-
MIDDLEWARE_CLASSES = (
22+
MIDDLEWARE= (
2223
'django.middleware.common.CommonMiddleware',
2324
'django.contrib.sessions.middleware.SessionMiddleware',
2425
'django.middleware.csrf.CsrfViewMiddleware',
@@ -28,10 +29,29 @@
2829

2930
ROOT_URLCONF = 'example.urls'
3031

32+
TEMPLATES = [
33+
{
34+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
35+
'DIRS': [abspath(join(PROJECT_DIR, 'templates'))],
36+
'APP_DIRS': True,
37+
'OPTIONS': {
38+
'context_processors': [
39+
"django.contrib.auth.context_processors.auth",
40+
"django.template.context_processors.debug",
41+
"django.template.context_processors.media",
42+
"django.template.context_processors.request",
43+
"django.template.context_processors.static",
44+
"django.contrib.messages.context_processors.messages",
45+
],
46+
},
47+
}
48+
]
49+
3150
INSTALLED_APPS = (
3251
'django.contrib.auth',
3352
'django.contrib.contenttypes',
3453
'django.contrib.sessions',
54+
'django.contrib.messages',
3555
'django.contrib.admin',
3656
'django.contrib.staticfiles',
3757
'multiselect',

example/urls.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
from django.conf.urls import * # noqa: F403
2-
1+
from django.conf.urls import url, include # noqa: F403
2+
from example.sample.views import index, index2
33
# Uncomment the next two lines to enable the admin:
44
from django.contrib import admin
55
admin.autodiscover()
66

7-
urlpatterns = patterns(
8-
'',
9-
url(r'^$', 'example.sample.views.index', name='index'),
10-
url(r'^2$', 'example.sample.views.index2', name='index2'),
7+
urlpatterns = [
8+
url(r'^$', index, name='index'),
9+
url(r'^2$', index2, name='index2'),
1110
# Example:
1211
# (r'^django_project/', include('django_project.foo.urls')),
1312

1413
# Uncomment the admin/doc line below to enable admin documentation:
1514
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
1615

1716
# Uncomment the next line to enable the admin:
18-
(r'^admin/', include(admin.site.urls)),
19-
)
17+
url(r'^admin/', admin.site.urls),
18+
]

multiselect/widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def old_render(self, name, value, attrs=None, choices=()):
8080
output.append('</select>')
8181
return mark_safe('\n'.join(output))
8282

83-
def render(self, name, value, attrs=None, choices=()):
83+
def render(self, name, value, attrs=None, choices=(), renderer=None):
8484
attrs = attrs or {}
8585
attrs['class'] = 'selectfilter'
8686
if self.is_stacked:

requirements/dist.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
django>=1.11,<1.12
1+
django>=2.2.0, <3

0 commit comments

Comments
 (0)