add use of NoteManager custom method, template fix

This commit is contained in:
Arthur Gerbaud
2016-08-07 12:02:51 +02:00
parent 9646c9f8ab
commit 473acf8f2b
4 changed files with 11 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
<div class="col-md-6">
{% if maraude.est_terminee %}
{% include "compte_rendu/compterendu.html" with maraude=compte_rendu %}
{% include "compte_rendu/compterendu.html" %}
{% else %}
{% if user.is_superuser %}<a class="btn btn-primary" href="{% url 'maraudes:create' maraude.pk %}">Écrire le compte-rendu</a>
{% else %} <p class="alert alert-info">Le compte-rendu n'a pas encore été écrit</p>{% endif %}

View File

@@ -66,12 +66,10 @@ class MaraudeDetailsView(MaraudesView, DerniereMaraudeMixin, generic.DetailView)
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['notes'] = Note.objects.get_queryset().filter(
created_date=self.object.date
).order_by(
'created_time'
)
context['compte_rendu'] = CompteRendu.objects.get(pk=self.object.pk)
context['notes'] = Note.objects.filter( #TODO: use better selection,
# using time range.
created_date=self.object.date
).by_time()
return context

View File

@@ -28,5 +28,5 @@ class SuiviSujetView(SuivisView, generic.DetailView):
def get_context_data(self, *args, **kwargs):
context = super().get_context_data(*args, **kwargs)
context['notes'] = self.object.notes.all().order_by('created_date')
context['notes'] = self.object.notes.by_date(reverse=True)
return context

View File

@@ -2,17 +2,17 @@
<div class="panel-heading"><h3 class="panel-title">Fiche informations</h3></div>
<div class="panel-body"><p class="label label-info">Première rencontre : {{ sujet.premiere_rencontre }}</p></div>
<table class="table">
<tr><th colspan="4" class="bg-info">État-civil</th></tr>
<tr><th colspan="4" class="active">État-civil</th></tr>
<tr><th>Nom</th><td>{{ sujet.nom|default:'?' }}</td><th>Prénom</th><td>{{ sujet.prenom|default:'?' }}</td></tr>
<tr><th>Sexe</th><td>{{ sujet.genre }}</td><th>Âge</th><td>{{ sujet.age|default:'?' }}</td></tr>
<tr><th colspan="4" class="bg-info">Problématiques</th></tr>
<tr><th colspan="4" class="active">Problématiques</th></tr>
<tr><th>Psychiatrique</th><td>{{ sujet.prob_psychiatrie }}</td><th>Addiction</th><td>{{ sujet.prob_addiction }}</td></tr>
<tr><th>Administratif</th><td>{{ sujet.prob_administratif }}</td><th>Somatique</th><td>{{ sujet.prob_somatique }}</td></tr>
<tr><th colspan="4" class="bg-info">Habitation</th></tr></td></tr>
<tr><th colspan="4" class="active">Habitation</th></tr></td></tr>
<tr><th>Type</th><td>{{ sujet.habitation }}</td><th>Connu du SIAO</th><td>{{ sujet.connu_siao }}</td></tr>
<tr><th colspan="4" class="bg-info">Ressources</th></tr></td></tr>
<tr><th colspan="4" class="active">Ressources</th></tr></td></tr>
<tr><td colspan="4">{{ sujet.ressources }}</td></tr>
<tr><th colspan="4" class="bg-info">Parcours de vie</th></tr></td></tr>
<tr><th colspan="4" class="active">Parcours de vie</th></tr></td></tr>
<tr><td colspan="2">{{ sujet.parcours_de_vie }}</td><th>Lien familial</th><td>{{ sujet.lien_familial }}</td></tr>
</table>
<div class="panel-footer text-right">