Added various things which lets us use Django's messages framework to give feedback to users. This includes adding the messages middleware in settings.py, adding a message display are at the top of the page base template, and adding style setting for message display.

- Legacy-Id: 4964
This commit is contained in:
Henrik Levkowetz 2012-10-30 13:28:24 +00:00
parent 4400ae2d25
commit f6c80779f9
3 changed files with 19 additions and 3 deletions

View file

@ -101,6 +101,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.RemoteUserMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.doc.XViewMiddleware',
'ietf.middleware.SQLLogMiddleware',
'ietf.middleware.SMTPExceptionMiddleware',
@ -120,6 +121,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
'ietf.context_processors.server_mode',
'ietf.context_processors.revision_info',
'ietf.context_processors.rfcdiff_prefix',
@ -134,6 +136,7 @@ INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.humanize',
'django.contrib.messages',
'south',
'workflows',
'permissions',

View file

@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{% comment %}
{% comment %}<!--
Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com>
@ -33,7 +33,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{% endcomment %}
-->{% endcomment %}
{% load ietf_filters %}
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
@ -85,7 +85,13 @@ Version {{ version_num }}, {{revision_date}}
</td>
<td>
<div style="padding:0 8px 0 8px;">
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% block content %}
{% endblock %}

View file

@ -194,3 +194,10 @@ form table .help {
.ballot-content h2.ad-ballot-comment { background: #2647A0; color: #fff; padding: 2px 4px; font-size: 108%; margin-top: 0;}
ul.messages { border: solid black 1px; margin: 0.4em 0; padding: 1em; }
li.debug { margin: 0.5em; background-color: #ccf; }
li.info { margin: 0.5em; background-color: #ff8; }
li.success { margin: 0.5em; background-color: #4f4; }
li.warning { margin: 0.5em; background-color: #fc8; color: black;}
li.error { margin: 0.5em; background-color: #f44; }