Skip to content

Commit 3a4ba51

Browse files
committed
Fixes Django 1.10 related issues
1 parent c901bf0 commit 3a4ba51

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ multi_line_output = 5
3232
line_length = 79
3333
combine_as_imports = true
3434
skip = wsgi.py,docs,tests/test_models.py
35+
known_first_party = stdimage,tests
36+
known_third_party = django

stdimage/management/commands/rendervariations.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ class Command(BaseCommand):
2828
args = '<app.model.field app.model.field>'
2929

3030
def add_arguments(self, parser):
31+
parser.add_argument('field_path',
32+
nargs='+',
33+
type=str,
34+
help='<app.model.field app.model.field>')
3135
parser.add_argument('--replace',
3236
action='store_true',
3337
dest='replace',
@@ -36,7 +40,8 @@ def add_arguments(self, parser):
3640

3741
def handle(self, *args, **options):
3842
replace = options.get('replace')
39-
for route in args:
43+
pathes = options['field_path'] if len(options['field_path']) else [options['field_path']]
44+
for route in pathes:
4045
app_label, model_name, field_name = route.rsplit('.')
4146
model_class = apps.get_model(app_label, model_name)
4247
field = model_class._meta.get_field(field_name)

tests/settings.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525

2626
DEFAULT_FILE_STORAGE = 'tests.storage.MyFileSystemStorage'
2727

28+
TEMPLATES = [
29+
{
30+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
31+
'APP_DIRS': True,
32+
}
33+
]
34+
2835
MIDDLEWARE_CLASSES = (
2936
'django.contrib.sessions.middleware.SessionMiddleware',
3037
'django.contrib.auth.middleware.AuthenticationMiddleware',

tests/urls.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
try:
2-
from django.conf.urls.defaults import patterns, url, include
3-
except ImportError:
4-
from django.conf.urls import patterns, url, include
5-
1+
from django.conf.urls import include, url
62
from django.contrib import admin
73

84
admin.autodiscover()
95

10-
urlpatterns = patterns(
11-
'',
6+
urlpatterns = [
127
url(r'^admin/', include(admin.site.urls)),
13-
)
8+
]

0 commit comments

Comments
 (0)