Skip to content

Commit 880292e

Browse files
committed
Update things to work and test with Django 1.10a
1 parent f749710 commit 880292e

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

simple_history/admin.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ def history_view(self, request, object_id, extra_context=None):
7575
'admin_user_view': admin_user_view
7676
}
7777
context.update(extra_context or {})
78-
return render(request, template_name=self.object_history_template,
79-
dictionary=context, current_app=request.current_app)
78+
return render(request, self.object_history_template, context)
8079

8180
def response_change(self, request, obj):
8281
if '_change_history' in request.POST and SIMPLE_HISTORY_EDIT:
@@ -178,8 +177,7 @@ def history_form_view(self, request, object_id, version_id):
178177
'save_on_top': self.save_on_top,
179178
'root_path': getattr(self.admin_site, 'root_path', None),
180179
}
181-
return render(request, template_name=self.object_history_form_template,
182-
dictionary=context, current_app=request.current_app)
180+
return render(request, self.object_history_form_template, context)
183181

184182
def save_model(self, request, obj, form, change):
185183
"""Set special model attribute to user for reference after save"""

simple_history/management/commands/populate_history.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,24 @@ class Command(BaseCommand):
2727
EXISTING_HISTORY_FOUND = "Existing history found, skipping model"
2828
INVALID_MODEL_ARG = "An invalid model was specified"
2929

30-
option_list = BaseCommand.option_list + (
31-
make_option(
30+
def add_arguments(self, parser):
31+
super(Command, self).add_arguments(parser)
32+
parser.add_argument('models', nargs='*', type=str)
33+
parser.add_argument(
3234
'--auto',
3335
action='store_true',
3436
dest='auto',
3537
default=False,
36-
help="Automatically search for models with the "
37-
"HistoricalRecords field type",
38-
),
39-
)
38+
help='Automatically search for models with the '
39+
'HistoricalRecords field type',
40+
)
4041

4142
def handle(self, *args, **options):
4243
to_process = set()
44+
model_strings = options['models'] or args
4345

44-
if args:
45-
for model_pair in self._handle_model_list(*args):
46+
if model_strings:
47+
for model_pair in self._handle_model_list(*model_strings):
4648
to_process.add(model_pair)
4749

4850
elif options['auto']:

simple_history/tests/tests/test_admin.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,7 @@ def test_history_form_view_without_getting_history(self):
427427
}
428428

429429
mock_render.assert_called_once_with(
430-
request, template_name=admin.object_history_form_template,
431-
dictionary=context, current_app=admin_site.name)
430+
request, admin.object_history_form_template, context)
432431

433432
def test_history_form_view_getting_history(self):
434433
request = RequestFactory().post('/')
@@ -484,8 +483,7 @@ def test_history_form_view_getting_history(self):
484483
}
485484

486485
mock_render.assert_called_once_with(
487-
request, template_name=admin.object_history_form_template,
488-
dictionary=context, current_app=admin_site.name)
486+
request, admin.object_history_form_template, context)
489487

490488
def test_history_form_view_getting_history_with_setting_off(self):
491489
request = RequestFactory().post('/')
@@ -540,5 +538,4 @@ def test_history_form_view_getting_history_with_setting_off(self):
540538
}
541539

542540
mock_render.assert_called_once_with(
543-
request, template_name=admin.object_history_form_template,
544-
dictionary=context, current_app=admin_site.name)
541+
request, admin.object_history_form_template, context)

tox.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ envlist =
44
py{27,33,34}-django17,
55
py{27,33,34,35}-django18,
66
py{27,34,35}-django19,
7+
py{27,34,35}-django110,
78
py{27,34,35}-djangotrunk,
89
docs, flake8
910

@@ -34,4 +35,6 @@ deps =
3435
django18: Django>=1.8,<1.9
3536
django19: Django>=1.9,<1.10
3637
djangotrunk: https://github.com/django/django/tarball/master
37-
commands = coverage run -a --branch setup.py test
38+
commands =
39+
django110: pip install Django>=1.10a,<1.11 --pre
40+
coverage run -a --branch setup.py test

0 commit comments

Comments
 (0)