Skip to content

Commit ab9cb73

Browse files
committed
fix run_serializers template (see #36)
1 parent 84b821b commit ab9cb73

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

data_wizard/templates/data_wizard/run_serializers.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ <h2>Data Format</h2>
99
</li>
1010
</ul>
1111
{% include "data_wizard/continue.html" %}
12-
{% elif not serializer_choices %}
12+
{% elif not result.serializer_choices %}
1313
<ul class="messagelist">
1414
<li class="error">No serializers registered.</li>
1515
</ul>
@@ -23,7 +23,7 @@ <h2>Data Format</h2>
2323
<fieldset data-role="controlgroup">
2424
<legend>Select Format</legend>
2525
<ul class="radiolist">
26-
{% for choice in serializer_choices %}
26+
{% for choice in result.serializer_choices %}
2727
<li>
2828
<label for="serializer-{{choice.name}}">
2929
<input type="radio" name="serializer" id="serializer-{{choice.name}}"

data_wizard/views.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def template_name(self):
4242
if self.action in ("create", "retrieve"):
4343
template = "detail"
4444
else:
45-
template = self.action
45+
template = self.task_action_paths.get(self.action, self.action)
4646
return "data_wizard/run_{}.html".format(template)
4747

4848
def get_renderers(self):
@@ -112,6 +112,7 @@ def run_and_retrieve(self, request, task_name):
112112
return response
113113

114114
task_actions_ready = False
115+
task_action_paths = {}
115116

116117
@classmethod
117118
def get_extra_actions(cls):
@@ -139,15 +140,19 @@ def task_action(self, request, *args, **kwargs):
139140
methods = ["POST"]
140141
else:
141142
methods = ["GET"]
142-
task_action.__name__ = task_name.split(".")[-1]
143+
task_action_name = task_name.split(".")[-1]
144+
task_action.__name__ = task_action_name
143145
task_action = action(
144146
detail=True,
145147
methods=methods,
146148
url_path=meta["url_path"],
147149
url_name=meta["url_path"],
148150
)(task_action)
149151

150-
setattr(cls, task_action.__name__, task_action)
152+
setattr(cls, task_action_name, task_action)
153+
cls.task_action_paths[task_action_name] = (
154+
meta["url_path"] or task_action_name
155+
)
151156

152157
@action(detail=True)
153158
def records(self, request, *args, **kwargs):

0 commit comments

Comments
 (0)