]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
about: Display admin contact details
authorAndrew Donnellan <ajd@linux.ibm.com>
Wed, 3 Jul 2019 03:39:53 +0000 (13:39 +1000)
committerStephen Finucane <stephen@that.guru>
Fri, 5 Jul 2019 10:55:00 +0000 (11:55 +0100)
Display the list of admins on the about page. Add an ADMINS_HIDE option if
you don't want the details displayed publicly.

Closes: #282 ("Display contact details for patchwork instance admins")
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Stephen Finucane <stephen@that.guru>
docs/deployment/configuration.rst
patchwork/settings/base.py
patchwork/settings/dev.py
patchwork/settings/production.example.py
patchwork/templates/patchwork/about.html
patchwork/views/about.py

index ba9a2ebc8c97687b279607abf9de9e077d40801e..30a1703541b5138a46fdb32ed56a9483d437c0c9 100644 (file)
@@ -38,6 +38,19 @@ Patchwork-specific Settings
 Patchwork utilizes a number of Patchwork-only settings in addition to the
 `Django`__ and `Django REST Framework`__ settings.
 
+__ https://docs.djangoproject.com/en/1.8/ref/settings/
+__ http://www.django-rest-framework.org/api-guide/settings/
+
+``ADMINS_HIDE``
+~~~~~~~~~~~~~~~
+
+If True, the details in `ADMINS`__ will be hidden from the *About* page
+(``/about``).
+
+.. versionadded:: 2.2
+
+__ https://docs.djangoproject.com/en/2.2/ref/settings/#admins
+
 ``DEFAULT_ITEMS_PER_PAGE``
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -112,5 +125,3 @@ Force use of ``https://`` links instead of guessing the scheme based on current
 access. This is useful if SSL protocol is terminated upstream of the server
 (e.g. at the load balancer)
 
-__ https://docs.djangoproject.com/en/1.8/ref/settings/
-__ http://www.django-rest-framework.org/api-guide/settings/
index 15644b40560432ba850f357b9b37cffa95fc84d3..65cd721c05c7118a840554951cf7d3b3240cf370 100644 (file)
@@ -227,3 +227,6 @@ COMPAT_REDIR = True
 # the scheme based on current access. This is useful if SSL protocol
 # is terminated upstream of the server (e.g. at the load balancer)
 FORCE_HTTPS_LINKS = False
+
+# Set to True to hide admin details from the about page (/about)
+ADMINS_HIDE = False
index 53fa58f65a489275dd9569d3d36f2305383ea812..e110e74579cad37ad4e501e68d4861a9df821d90 100644 (file)
@@ -24,6 +24,9 @@ except ImportError:
 # https://docs.djangoproject.com/en/1.11/ref/settings/#core-settings
 #
 
+ADMINS = (
+    ('Joe Bloggs', 'jbloggs@example.com'),
+)
 
 ALLOWED_HOSTS = ['*']
 
index f58896fc0ac7da5ebcc4dfd6e5b9882362bf6d07..c6aa2f2850c0c26a93d366c5e3258e2e62a858cc 100644 (file)
@@ -42,7 +42,8 @@ SERVER_EMAIL = DEFAULT_FROM_EMAIL
 NOTIFICATION_FROM_EMAIL = DEFAULT_FROM_EMAIL
 
 ADMINS = (
-    ('Jeremy Kerr', 'jk@ozlabs.org'),
+    # Add administrator contact details in the form:
+    # ('Jeremy Kerr', 'jk@ozlabs.org'),
 )
 
 # Database
index f602c1351b56743e9baee3efdf8f83469154e28c..210e9513c4f4dc0105b0f43159d650444c30d227 100644 (file)
     </ul>
   </div>
 
+  {% if admins %}
+  <div class="panel panel-default">
+    <div class="panel-heading">
+      <h3 class="panel-title">Administrators</h3>
+    </div>
+    <ul class="list-group">
+      {% for admin in admins %}
+      <li class="list-group-item">
+        <a href="mailto:{{ admin.1 }}">{{ admin.0 }}</a>
+      </li>
+      {% endfor %}
+    </ul>
+  </div>
+  {% endif %}
+
   <div class="panel panel-default">
     <div class="panel-heading">
       <h3 class="panel-title">API Status</h3>
index 0061a31952986cc2a1d9487b75ec185929676bfa..91c3b74ebf8f1c8ce9360185ac443d60b4b96b5c 100644 (file)
@@ -16,6 +16,7 @@ def about(request):
             'rest': settings.ENABLE_REST_API,
             'xmlrpc': settings.ENABLE_XMLRPC,
         },
+        'admins': () if settings.ADMINS_HIDE else settings.ADMINS,
     }
 
     return render(request, 'patchwork/about.html', context)