[v2,6/6] Revert "api: Only provide JSON version of events list"

Message ID 20180409210256.19649-7-stephen@that.guru
State Rejected
Headers show
Series
  • Add 'Event.payload' field
Related show

Commit Message

Stephen Finucane April 9, 2018, 9:02 p.m.
This reverts commit 90d9ee14e73e8ec9248e89c788d64867c4a4bb74.

This isn't necessary now that we're storing JSON blobs in the database
instead and have stopped generating huge '<select>'s for various Event
fields.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Cc: Daniel Axtens <dja@axtens.net>
---
 patchwork/api/event.py                        | 16 ----------------
 patchwork/templates/patchwork/event-list.html | 17 -----------------
 2 files changed, 33 deletions(-)
 delete mode 100644 patchwork/templates/patchwork/event-list.html

Patch

diff --git a/patchwork/api/event.py b/patchwork/api/event.py
index 482dec1e..7843d483 100644
--- a/patchwork/api/event.py
+++ b/patchwork/api/event.py
@@ -17,13 +17,9 @@ 
 # along with Patchwork; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-import json
-
 from rest_framework.generics import ListAPIView
 from rest_framework.reverse import reverse
 from rest_framework.serializers import ModelSerializer
-from rest_framework.renderers import JSONRenderer
-from rest_framework.renderers import TemplateHTMLRenderer
 from rest_framework.serializers import ReadOnlyField
 from rest_framework.serializers import Serializer
 
@@ -112,21 +108,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 = EventFilter
     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 821c6897..00000000
--- 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 %}