def render_to_response(self, context, *args, **kwargs):
preview_outputs = []<EOL>file_outputs = []<EOL>bast_ctx = context<EOL>added = set()<EOL>for output_group, output_files in context['<STR_LIT>']['<STR_LIT>'].items():<EOL><INDENT>for output_file_content in output_files:<EOL><INDENT>if output_group:<EOL><INDENT>bast_ctx.update({<EOL>'<STR_LIT>': context['<STR_LIT>'],<EOL>'<STR_LIT>': output_group,<EOL>'<STR_LIT>': output_file_content,<EOL>})<EOL>preview = render_to_string('<STR_LIT>' % output_group, bast_ctx)<EOL>preview_outputs.append(preview)<EOL><DEDENT><DEDENT><DEDENT>for file_info in context['<STR_LIT>']['<STR_LIT>']:<EOL><INDENT>if file_info and file_info.get('<STR_LIT:name>') not in added:<EOL><INDENT>row_ctx = dict(<EOL>file=file_info,<EOL>**context<EOL>)<EOL>table_row = render_to_string('<STR_LIT>', row_ctx)<EOL>file_outputs.append(table_row)<EOL>added.add(file_info.get('<STR_LIT:name>'))<EOL><DEDENT><DEDENT>return JsonResponse({<EOL>'<STR_LIT:status>': context['<STR_LIT>']['<STR_LIT:status>'].lower(),<EOL>'<STR_LIT>': context['<STR_LIT>']['<STR_LIT>'].command,<EOL>'<STR_LIT>': context['<STR_LIT>']['<STR_LIT>'].get_stdout(),<EOL>'<STR_LIT>': context['<STR_LIT>']['<STR_LIT>'].get_stderr(),<EOL>'<STR_LIT>': preview_outputs,<EOL>'<STR_LIT>': file_outputs,<EOL>})<EOL>
Build dictionary of content