From: Andrew Donnellan Date: Wed, 3 Jul 2019 03:39:53 +0000 (+1000) Subject: about: Display admin contact details X-Git-Tag: v2.2.0-rc1~105 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bee2eb32cef7a4b5e61b041ec653c1fe540dd76a;p=thirdparty%2Fpatchwork.git about: Display admin contact details 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 Signed-off-by: Stephen Finucane --- diff --git a/docs/deployment/configuration.rst b/docs/deployment/configuration.rst index ba9a2ebc..30a17035 100644 --- a/docs/deployment/configuration.rst +++ b/docs/deployment/configuration.rst @@ -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/ diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py index 15644b40..65cd721c 100644 --- a/patchwork/settings/base.py +++ b/patchwork/settings/base.py @@ -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 diff --git a/patchwork/settings/dev.py b/patchwork/settings/dev.py index 53fa58f6..e110e745 100644 --- a/patchwork/settings/dev.py +++ b/patchwork/settings/dev.py @@ -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 = ['*'] diff --git a/patchwork/settings/production.example.py b/patchwork/settings/production.example.py index f58896fc..c6aa2f28 100644 --- a/patchwork/settings/production.example.py +++ b/patchwork/settings/production.example.py @@ -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 diff --git a/patchwork/templates/patchwork/about.html b/patchwork/templates/patchwork/about.html index f602c135..210e9513 100644 --- a/patchwork/templates/patchwork/about.html +++ b/patchwork/templates/patchwork/about.html @@ -26,6 +26,21 @@ + {% if admins %} +
+
+

Administrators

+
+
    + {% for admin in admins %} +
  • + {{ admin.0 }} +
  • + {% endfor %} +
+
+ {% endif %} +

API Status

diff --git a/patchwork/views/about.py b/patchwork/views/about.py index 0061a319..91c3b74e 100644 --- a/patchwork/views/about.py +++ b/patchwork/views/about.py @@ -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)