petitscours: rediriger directement vers la liste après traitement d'une demande
This commit is contained in:
parent
e357f57d61
commit
44eb767aa2
2 changed files with 9 additions and 10 deletions
|
@ -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 %}
|
|
|
@ -8,6 +8,7 @@ from django.core import mail
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.shortcuts import get_object_or_404, redirect, render
|
from django.shortcuts import get_object_or_404, redirect, render
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.views.generic import DetailView, ListView
|
from django.views.generic import DetailView, ListView
|
||||||
|
@ -195,11 +196,16 @@ def _traitement_post(request, demande):
|
||||||
demande.traitee_par = request.user
|
demande.traitee_par = request.user
|
||||||
demande.processed = timezone.now()
|
demande.processed = timezone.now()
|
||||||
demande.save()
|
demande.save()
|
||||||
return render(
|
|
||||||
|
messages.success(
|
||||||
request,
|
request,
|
||||||
"petitscours/traitement_demande_success.html",
|
f"Demande de {demande.name} {'re' if redo else ''}traitée avec succès !",
|
||||||
{"demande": demande, "redo": redo},
|
|
||||||
)
|
)
|
||||||
|
if redo:
|
||||||
|
return redirect(demande.get_absolute_url())
|
||||||
|
else:
|
||||||
|
return redirect(reverse("petits-cours-demandes-list"))
|
||||||
|
|
||||||
|
|
||||||
def _traitement_attributions(request, demande):
|
def _traitement_attributions(request, demande):
|
||||||
proposals = {}
|
proposals = {}
|
||||||
|
|
Loading…
Reference in a new issue