diff options
author | Stephen Finucane <stephen@that.guru> | 2018-05-10 15:45:06 +0100 |
---|---|---|
committer | Daniel Axtens <dja@axtens.net> | 2018-05-12 02:45:35 +1000 |
commit | 30c8a4909bf8c0dab881464605d669de0f309ccb (patch) | |
tree | f91658fd80c3d368b351733e6f6caee3832a5372 | |
parent | 841228eb95360a251b37e76e0387f106b1017454 (diff) | |
download | patchwork-30c8a4909bf8c0dab881464605d669de0f309ccb.tar patchwork-30c8a4909bf8c0dab881464605d669de0f309ccb.tar.gz |
Revert "api: Only provide JSON version of events list"
This reverts commit 90d9ee14e73e8ec9248e89c788d64867c4a4bb74.
The root cause of this performance issue was not the use of the
JSONRenderer but rather the population of filter forms. The latter is
now disabled, meaning we can start using the original renderer.
Signed-off-by: Stephen Finucane <stephen@that.guru>
Cc: Daniel Axtens <dja@axtens.net>
Acked-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Daniel Axtens <dja@axtens.net>
-rw-r--r-- | patchwork/api/event.py | 15 | ||||
-rw-r--r-- | patchwork/templates/patchwork/event-list.html | 17 |
2 files changed, 0 insertions, 32 deletions
diff --git a/patchwork/api/event.py b/patchwork/api/event.py index b6626ec..cce25a7 100644 --- a/patchwork/api/event.py +++ b/patchwork/api/event.py @@ -18,13 +18,10 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from collections import OrderedDict -import json from rest_framework.generics import ListAPIView from rest_framework.serializers import ModelSerializer from rest_framework.serializers import SerializerMethodField -from rest_framework.renderers import JSONRenderer -from rest_framework.renderers import TemplateHTMLRenderer from patchwork.api.embedded import CheckSerializer from patchwork.api.embedded import CoverLetterSerializer @@ -88,21 +85,9 @@ class EventSerializer(ModelSerializer): read_only_fields = fields -# The standard template html renderer is broken: -# https://github.com/encode/django-rest-framework/issues/5236 -class JSONListHTMLRenderer(TemplateHTMLRenderer): - def get_template_context(self, data, renderer_context): - response = renderer_context['response'] - if response.exception: - data['status_code'] = response.status_code - return {'data': json.dumps(data, indent=4)} - - class EventList(ListAPIView): """List events.""" - renderer_classes = (JSONRenderer, JSONListHTMLRenderer) - template_name = 'patchwork/event-list.html' serializer_class = EventSerializer filter_class = EventFilterSet page_size_query_param = None # fixed page size diff --git a/patchwork/templates/patchwork/event-list.html b/patchwork/templates/patchwork/event-list.html deleted file mode 100644 index 821c689..0000000 --- a/patchwork/templates/patchwork/event-list.html +++ /dev/null @@ -1,17 +0,0 @@ -{% extends "base.html" %} - -{% load person %} -{% load static %} - -{% block title %}Event List{% endblock %} -{% block patch_active %}active{% endblock %} - -{% block body %} - -<p>Due to a currently undiagnosed issue with django-rest-framework, the browsable API is very CPU intensive and has been disabled. The JSON output is:</p> - -<pre> -{{data}} -</pre> - -{% endblock %} |