proper use of messages in petits cours

This commit is contained in:
Martin Pépin 2017-01-30 13:50:24 +01:00
parent fd42563f7f
commit 8c34e2f83f
2 changed files with 4 additions and 13 deletions

View file

@ -1,9 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from django.shortcuts import render, get_object_or_404, redirect
from django.core import mail
from django.core.mail import EmailMessage
@ -17,6 +13,7 @@ from django.views.decorators.csrf import csrf_exempt
from django.template import loader
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.db.models import Min
from gestioncof.models import CofProfile
@ -29,7 +26,6 @@ from gestioncof.shared import lock_table, unlock_tables
from captcha.fields import ReCaptchaField
from datetime import datetime
import base64
import json
@ -139,7 +135,9 @@ def _finalize_traitement(request, demande, proposals, proposed_for,
'style="width:99%; height: 90px;">'
'</textarea>'
})
return render(request, "traitement_demande_petit_cours.html",
for error in errors:
messages.error(request, error)
return render(request, "petits_cours/traitement_demande.html",
{"demande": demande,
"unsatisfied": unsatisfied,
"proposals": proposals,
@ -148,7 +146,6 @@ def _finalize_traitement(request, demande, proposals, proposed_for,
"mainmail": mainmail,
"attribdata": json.dumps(attribdata),
"redo": redo,
"errors": errors,
})

View file

@ -4,12 +4,6 @@
<h2>Traitement de la demande de petits cours {{ demande.id }}</h2>
{% include "details_demande_petit_cours_infos.html" %}
<hr />
{% if errors %}
<div class="error">
Attention:
<ul>{% for error in errors %}<li>{{ error }}</li>{% endfor %}</ul>
</div>
{% endif %}
{% if unsatisfied %}
<div class="error">
Attention: Impossible de trouver des propositions pour les matières suivantes: