WIP: petitscours: UI improvements #843

Draft
llanteri wants to merge 6 commits from petitscours into master
2 changed files with 9 additions and 10 deletions
Showing only changes of commit 44eb767aa2 - Show all commits

View file

@ -1,7 +0,0 @@
{% extends "petitscours/base_title.html" %}
{% block realcontent %}
<h2>Traitement de la demande de petits cours {{ demande.id }}</h2>
<div class="success" style="margin: 15px 0px; font-size: 1.4em;">Demande {{ demande.id }} de {{ demande.name }} {% if redo %}re{% endif %}traitée avec succès !</div>
<a href="{% url "petits-cours-demandes-list" %}">Retour à la liste des demandes</a>
{% endblock %}

View file

@ -8,6 +8,7 @@ from django.core import mail
from django.db import transaction
from django.shortcuts import get_object_or_404, redirect, render
from django.template import loader
from django.urls import reverse
from django.utils import timezone
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import DetailView, ListView
@ -195,11 +196,16 @@ def _traitement_post(request, demande):
demande.traitee_par = request.user
demande.processed = timezone.now()
demande.save()
return render(
messages.success(
request,
"petitscours/traitement_demande_success.html",
{"demande": demande, "redo": redo},
f"Demande de {demande.name} {'re' if redo else ''}traitée avec succès !",
)
if redo:
return redirect(demande.get_absolute_url())
else:
return redirect(reverse("petits-cours-demandes-list"))
def _traitement_attributions(request, demande):
proposals = {}