using context_object_name and moving template

This commit is contained in:
Qwann 2017-02-11 02:51:43 +01:00
parent 45eb384cfd
commit ed01508481
2 changed files with 10 additions and 9 deletions

View file

@ -34,11 +34,12 @@ class DemandeListView(ListView):
class DemandeDetailView(DetailView):
model = PetitCoursDemande
template_name = "details_demande_petit_cours.html"
template_name = "gestioncof/details_demande_petit_cours.html"
context_object_name = "demande"
def get_context_data(self, **kwargs):
context = super(DemandeDetailView, self).get_context_data(**kwargs)
obj = context['object']
obj = self.object
context['attributions'] = obj.petitcoursattribution_set.all()
return context

View file

@ -8,10 +8,10 @@
{% include "details_demande_petit_cours_infos.html" %}
<hr />
<table class="table table-striped">
<tr><td><strong>Traitée</strong></td><td> <img src="{% if object.traitee %}{% static "images/yes.png" %}{% else %}{% static "images/no.png" %}{% endif %}" /></td></tr>
{% if object.traitee %}
<tr><td><strong>Traitée par</strong></td><td> {{ object.traitee_par }}</td></tr>
<tr><td><strong>Traitée le</strong></td><td> {{ object.processed }}</td></tr>
<tr><td><strong>Traitée</strong></td><td> <img src="{% if demande.traitee %}{% static "images/yes.png" %}{% else %}{% static "images/no.png" %}{% endif %}" /></td></tr>
{% if demande.traitee %}
<tr><td><strong>Traitée par</strong></td><td> {{ demande.traitee_par }}</td></tr>
<tr><td><strong>Traitée le</strong></td><td> {{ demande.processed }}</td></tr>
<tr><td>
<strong>Attributions</strong></td><td>
<ul>
@ -23,15 +23,15 @@
</tr>
{% endif %}
</table>
{% if object.traitee %}
{% if demande.traitee %}
<div style="text-align: right;">
<form action="{% url "petits-cours-demande-retraitement" object.id %}">
<form action="{% url "petits-cours-demande-retraitement" demande.id %}">
<input class="btn btn-primary" type="submit" value="Retraiter">
</form>
</div>
{% else %}
<div style="text-align: right;">
<form action="{% url "petits-cours-demande-traitement" object.id %}">
<form action="{% url "petits-cours-demande-traitement" demande.id %}">
<input class="btn btn-primary" type="submit" value="Traiter">
</form>
</div>