[PATCH 2/2] templates: Add API status to about page

Stephen Finucane stephen at that.guru
Thu Oct 20 18:24:28 AEDT 2016


This is useful given that these APIs can be disabled, and likely will
be for deployments where django-rest-framework is not available.

The version is currently hardcoded, but this will be resolved in a
future change.

Signed-off-by: Stephen Finucane <stephen at that.guru>
---
 patchwork/templates/patchwork/about.html | 53 +++++++++++++++++++++++++++++---
 patchwork/views/about.py                 |  9 +++++-
 2 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/patchwork/templates/patchwork/about.html b/patchwork/templates/patchwork/about.html
index ed0c421..4512fae 100644
--- a/patchwork/templates/patchwork/about.html
+++ b/patchwork/templates/patchwork/about.html
@@ -4,11 +4,54 @@
 {% block heading %}About Patchwork{% endblock %}
 
 {% block body %}
-<h1>About Patchwork</h1>
+<div class="container">
+  <h1>About Patchwork</h1>
 
-<p>Patchwork is free software, and is available from the
-<a href="http://jk.ozlabs.org/projects/patchwork/">Patchwork website</a>.</p>
+  <p>Patchwork is free software, and is available from the <a
+     href="http://jk.ozlabs.org/projects/patchwork/">Patchwork website</a>.
+     Documentation is available on <a
+     href="http://patchwork.readthedocs.io/">Read the Docs</a>.</p>
 
-<p>Patchwork is built on the <a href="http://djangoproject.com/">Django</a>
-web framework.</p>
+  <p>Patchwork is built on the <a href="https://djangoproject.com/">Django</a>
+  web framework using <a href="https://getbootstrap.com/">Bootstrap</a>.</p>
+
+  <div class="panel panel-default">
+    <div class="panel-heading">
+      <h3 class="panel-title">Version</h3>
+    </div>
+    <ul class="list-group">
+      <li class="list-group-item">
+        <p>2.0.0-pre</p>
+      </li>
+    </ul>
+  </div>
+
+  <div class="panel panel-default">
+    <div class="panel-heading">
+      <h3 class="panel-title">API Status</h3>
+    </div>
+    <ul class="list-group">
+      <li class="list-group-item">
+        REST
+        <span class="glyphicon glyphicon-question-sign" title="The REST
+          API"></span>
+        {% if enabled_apis.rest %}
+        <span class="label label-success pull-right">enabled</span>
+        {% else %}
+        <span class="label label-danger pull-right">disabled</span>
+        {% endif %}
+      </li>
+      <li class="list-group-item">
+        XML-RPC
+        <span class="glyphicon glyphicon-question-sign" title="The XML-RPC
+          API"></span>
+        {% if enabled_apis.xmlrpc %}
+        <span class="label label-success pull-right">enabled</span>
+        {% else %}
+        <span class="label label-danger pull-right">disabled</span>
+        {% endif %}
+      </li>
+    </ul>
+  </div>
+</div>
 {% endblock %}
diff --git a/patchwork/views/about.py b/patchwork/views/about.py
index 5fd50c1..b7cfbcf 100644
--- a/patchwork/views/about.py
+++ b/patchwork/views/about.py
@@ -25,4 +25,11 @@ from django.shortcuts import render
 
 
 def about(request):
-    return render(request, 'patchwork/about.html')
+    context = {
+        'enabled_apis': {
+            'rest': settings.ENABLE_REST_API,
+            'xmlrpc': settings.ENABLE_XMLRPC,
+         }
+    }
+
+    return render(request, 'patchwork/about.html', context)
-- 
2.7.4



More information about the Patchwork mailing list