"""
from django.core.urlresolvers import reverse
return reverse('rh_photo', kwargs={'id':self.id})
-
- def postes_encours(self):
- pass
-
+
def dossiers_passes(self):
today = date.today()
return self.dossiers.filter(date_fin__lt=today).order_by('-date_fin')
dossiers_p_f = self.dossiers_passes() | self.dossiers_futurs()
ids_dossiers_p_f = [d.id for d in dossiers_p_f]
return self.dossiers.exclude(id__in=ids_dossiers_p_f).order_by('-date_fin')
+
+ def postes_encours(self):
+ postes_encours = set()
+ for d in self.dossiers_encours():
+ postes_encours.add(d.poste)
+ return postes_encours
+
+ def poste_principal(self):
+ return self.dossiers_encours()[0].poste
class EmployePiece(models.Model):
"""Documents relatifs à un employé.
<div class="gauche">
<h1>{{ employe.civilite }} {{ employe }}</h1>
- {% for d in employe.dossiers_encours %}
- <p>
+ <p>
+ {% for p in employe.postes_encours %}
{% if employe.genre.upper == 'F' %}
- {{ d.poste.nom_feminin }}
+ {{ p.nom_feminin }}
{% else %}
- {{ d.poste.nom }}
+ {{ p.nom }}
{% endif %}
- </p>
- <p>
- {{ d.poste.service|default_if_none:"Service inconnu" }}<br />
- {{ d.poste.implantation.nom|default_if_none:"Implantation inconnue" }}<br />
- {{ d.poste.implantation.adresse_physique_ville|default_if_none:"Ville inconnue" }}
- </p>
+ {% if not forloop.last %}<br />{% endif %}
{% endfor %}
+ </p>
+ <p>
+ {{ employe.poste_principal.service|default_if_none:"Service inconnu" }}<br />
+ {{ employe.poste_principal.implantation.nom|default_if_none:"Implantation inconnue" }}<br />
+ {{ employe.poste_principal.implantation.adresse_physique_ville|default_if_none:"Ville inconnue" }}
+ </p>
</div>
</div>