def render_to_response(self, context, **response_kwargs): format = self.kwargs.get('format') if format == 'xml': serializer = ViewExportSerializer(context['views'], many=True) xml = ViewRenderer().render(serializer.data) return XMLResponse(xml, name='views') else: return render_to_format(self.request, format, _('Views'), 'views/views_export.html', context)
def render_to_response(self, context, **response_kwargs): format = self.kwargs.get('format') if format == 'xml': serializer = OptionSetExportSerializer(context['optionsets'], many=True) xml = OptionSetRenderer().render(serializer.data) return XMLResponse(xml, name='options') else: return render_to_format(self.request, format, _('Options'), 'options/options_export.html', context)
def render_to_response(self, context, **response_kwargs): format = self.kwargs.get('format') if format == 'xml': serializer = CatalogExportSerializer(context['catalog']) xml = CatalogRenderer().render([serializer.data]) return XMLResponse(xml, name=context['catalog'].key) else: return render_to_format(self.request, format, context['catalog'].title, 'questions/catalog_export.html', context)
def render_to_response(self, context, **response_kwargs): format = self.kwargs.get('format') if format == 'xml': serializer = AttributeExportSerializer(context['attributes'], many=True) xml = AttributeRenderer().render(serializer.data) return XMLResponse(xml, name='domain') elif format[:3] == 'csv': if format == 'csvcomma': delimiter = ',' else: delimiter = ';' rows = [] for attribute in context['attributes']: rows.append((attribute.key, attribute.comment, attribute.uri)) return render_to_csv(_('Domain'), rows, delimiter) else: return render_to_format(self.request, format, _('Domain'), 'domain/domain_export.html', context)
def detail_export(self, request, pk=None): serializer = AttributeExportSerializer(self.get_object()) xml = AttributeRenderer().render([serializer.data]) return XMLResponse(xml, name=self.get_object().key)
def export(self, request): serializer = AttributeExportSerializer(self.get_queryset(), many=True) xml = AttributeRenderer().render(serializer.data) return XMLResponse(xml, name='attributes')
def export(self, request): serializer = TaskExportSerializer(self.get_queryset(), many=True) xml = TaskRenderer().render(serializer.data) return XMLResponse(xml, name='tasks')
def export(self, request): serializer = SectionExportSerializer(self.get_queryset(), many=True) xml = SectionRenderer().render(serializer.data) return XMLResponse(xml, name='sections')
def export(self, request): serializer = CatalogExportSerializer(self.get_queryset(), many=True) xml = CatalogRenderer().render(serializer.data) return XMLResponse(xml, name='catalogs')
def detail_export(self, request, pk=None): serializer = QuestionExportSerializer(self.get_object()) xml = QuestionRenderer().render([serializer.data]) return XMLResponse(xml, name=self.get_object().path)
def export(self, request): serializer = QuestionSetExportSerializer(self.get_queryset(), many=True) xml = QuestionSetRenderer().render(serializer.data) return XMLResponse(xml, name='questionsets')
def detail_export(self, request, pk=None): queryset = self.get_object().get_descendants(include_self=True) serializer = AttributeExportSerializer(queryset, many=True) xml = AttributeRenderer().render(serializer.data) return XMLResponse(xml, name=self.get_object().key)