forked from DGNum/gestioCOF
using context_object_name and moving template
This commit is contained in:
parent
45eb384cfd
commit
ed01508481
2 changed files with 10 additions and 9 deletions
|
@ -34,11 +34,12 @@ class DemandeListView(ListView):
|
||||||
|
|
||||||
class DemandeDetailView(DetailView):
|
class DemandeDetailView(DetailView):
|
||||||
model = PetitCoursDemande
|
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):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(DemandeDetailView, self).get_context_data(**kwargs)
|
context = super(DemandeDetailView, self).get_context_data(**kwargs)
|
||||||
obj = context['object']
|
obj = self.object
|
||||||
context['attributions'] = obj.petitcoursattribution_set.all()
|
context['attributions'] = obj.petitcoursattribution_set.all()
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
{% include "details_demande_petit_cours_infos.html" %}
|
{% include "details_demande_petit_cours_infos.html" %}
|
||||||
<hr />
|
<hr />
|
||||||
<table class="table table-striped">
|
<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>
|
<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 object.traitee %}
|
{% if demande.traitee %}
|
||||||
<tr><td><strong>Traitée par</strong></td><td> {{ object.traitee_par }}</td></tr>
|
<tr><td><strong>Traitée par</strong></td><td> {{ demande.traitee_par }}</td></tr>
|
||||||
<tr><td><strong>Traitée le</strong></td><td> {{ object.processed }}</td></tr>
|
<tr><td><strong>Traitée le</strong></td><td> {{ demande.processed }}</td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
<strong>Attributions</strong></td><td>
|
<strong>Attributions</strong></td><td>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -23,15 +23,15 @@
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</table>
|
</table>
|
||||||
{% if object.traitee %}
|
{% if demande.traitee %}
|
||||||
<div style="text-align: right;">
|
<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">
|
<input class="btn btn-primary" type="submit" value="Retraiter">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div style="text-align: right;">
|
<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">
|
<input class="btn btn-primary" type="submit" value="Traiter">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
Loading…
Reference in a new issue