added missing_cr context variable on maraudes:index, small fixes
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">Votre prochaine maraude</div>
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">Votre prochaine maraude</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
{% if prochaine_maraude %}<p>
|
||||
<span class="glyphicon glyphicon-calendar"></span>
|
||||
@@ -16,9 +18,12 @@
|
||||
{% if user.is_superuser %}
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-warning">
|
||||
<div class="panel-heading">Compte-rendus en retard</div>
|
||||
<table class="table">
|
||||
<tr><td>Lister les comptes-rendu passés qui ne sont pas finalisés</td></tr>
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">Compte-rendus en retard</h4>
|
||||
</div>
|
||||
<table class="table">{% for cr in missing_cr %}
|
||||
<tr><td><a href="{% url 'maraudes:create' pk=cr.pk %}" class="btn btn-link">{{cr.date}}</a></td><td>{{cr.referent}} & {{cr.binome}}</td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -63,6 +63,11 @@ class IndexView(DerniereMaraudeMixin, generic.TemplateView):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['prochaine_maraude_abs'] = self.get_prochaine_maraude()
|
||||
context['prochaine_maraude'] = self.get_prochaine_maraude_for_user()
|
||||
if self.request.user.is_superuser:
|
||||
context['missing_cr'] = CompteRendu.objects.get_queryset().filter(
|
||||
heure_fin__isnull=True,
|
||||
date__lte = timezone.localtime(timezone.now()).date()
|
||||
)
|
||||
return context
|
||||
|
||||
def get_prochaine_maraude_for_user(self):
|
||||
@@ -113,7 +118,7 @@ class MaraudeListView(DerniereMaraudeMixin, generic.ListView):
|
||||
def get_queryset(self):
|
||||
today = datetime.date.today()
|
||||
return super().get_queryset().filter(
|
||||
date__lte=datetime.date.today()
|
||||
date__lte=timezone.localtime(timezone.now()).date()
|
||||
).order_by('-date')
|
||||
|
||||
|
||||
|
||||
@@ -27,12 +27,13 @@ class IndexView(NoteFormMixin, generic.TemplateView):
|
||||
'appel': AppelForm,
|
||||
'signalement': SignalementForm,
|
||||
}
|
||||
success_url = "/suivi/"
|
||||
#FormView
|
||||
template_name = "suivi/index.html"
|
||||
def get_initial(self):
|
||||
return {'created_date': timezone.localtime(timezone.now()).date(),
|
||||
'created_time': timezone.localtime(timezone.now()).time()}
|
||||
def get_success_url(self):
|
||||
return reverse('suivi:index')
|
||||
#FormView
|
||||
template_name = "suivi/index.html"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ class Organisme(models.Model):
|
||||
def __str__(self):
|
||||
return self.nom
|
||||
|
||||
|
||||
|
||||
class Professionnel(User):
|
||||
""" Professionnel d'un organisme """
|
||||
organisme = models.ForeignKey(
|
||||
@@ -43,6 +45,7 @@ class Professionnel(User):
|
||||
)
|
||||
|
||||
|
||||
|
||||
class Maraudeur(Professionnel):
|
||||
""" Professionnels qui participent aux maraudes """
|
||||
|
||||
|
||||
Reference in New Issue
Block a user