add use of NoteManager custom method, template fix
This commit is contained in:
@@ -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 %}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user