diff options
author | Andrew Donnellan <ajd@linux.ibm.com> | 2019-07-03 13:39:53 +1000 |
---|---|---|
committer | Stephen Finucane <stephen@that.guru> | 2019-07-05 11:55:00 +0100 |
commit | bee2eb32cef7a4b5e61b041ec653c1fe540dd76a (patch) | |
tree | a459b4f2aaf08c4e8ac5a6febf5100c7dc1f54e8 | |
parent | f48179f6368982fdeb7f2dfb515f1972d86b0991 (diff) | |
download | patchwork-bee2eb32cef7a4b5e61b041ec653c1fe540dd76a.tar patchwork-bee2eb32cef7a4b5e61b041ec653c1fe540dd76a.tar.gz |
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 <ajd@linux.ibm.com>
Signed-off-by: Stephen Finucane <stephen@that.guru>
-rw-r--r-- | docs/deployment/configuration.rst | 15 | ||||
-rw-r--r-- | patchwork/settings/base.py | 3 | ||||
-rw-r--r-- | patchwork/settings/dev.py | 3 | ||||
-rw-r--r-- | patchwork/settings/production.example.py | 3 | ||||
-rw-r--r-- | patchwork/templates/patchwork/about.html | 15 | ||||
-rw-r--r-- | patchwork/views/about.py | 1 |
6 files changed, 37 insertions, 3 deletions
diff --git a/docs/deployment/configuration.rst b/docs/deployment/configuration.rst index ba9a2eb..30a1703 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 15644b4..65cd721 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 53fa58f..e110e74 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 f58896f..c6aa2f2 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 f602c13..210e951 100644 --- a/patchwork/templates/patchwork/about.html +++ b/patchwork/templates/patchwork/about.html @@ -26,6 +26,21 @@ </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> diff --git a/patchwork/views/about.py b/patchwork/views/about.py index 0061a31..91c3b74 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) |