search_fields = ('id', 'nom', 'prenom', 'nom_affichage', )
ordering = ('nom', )
form = EmployeAdminForm
- list_display = ('_id', '_apercu', '_nom', '_dossiers', '_date_modification', 'user_modification', )
+ list_display = ('_id', '_apercu', '_nom', '_dossiers_postes', '_date_modification', 'user_modification', )
list_display_links = ('_nom',)
list_filter = ('rh_dossiers__poste__implantation__region', 'rh_dossiers__poste__implantation', 'nb_postes', 'rh_dossiers__date_debut', 'rh_dossiers__date_fin')
date_borne_gauche = 'rh_dossiers__date_debut'
_date_modification.short_description = u'date modification'
_date_modification.admin_order_field = 'date_modification'
- def _dossiers(self, obj):
+ def _dossiers_postes(self, obj):
l = []
for d in obj.rh_dossiers.all().order_by('-date_debut'):
- apercu = u"""<a title="Aperçu du dossier" href="%s" onclick="return showAddAnotherPopup(this);" title="Aperçu du dossier"><img src="%simg/loupe.png" /></a>""" % \
- (reverse('dossier_apercu', args=(d.id,)), settings.STATIC_URL,)
- link = u"""<li>%s<a href='%s'>%s : %s</a></li>""" % \
- (apercu,
- reverse('admin:rh_dossier_change', args=(d.id,)),
+ dossier = u"""<a title="Aperçu du dossier" href="%s" onclick="return showAddAnotherPopup(this);" title="Aperçu du dossier"><img src="%simg/loupe.png" /></a><a href="%s">Dossier</a> """ % \
+ ( reverse('dossier_apercu', args=(d.id,)),
+ settings.STATIC_URL,
+ reverse('admin:rh_dossier_change', args=(d.id,))
+ )
+
+ poste = u"""<a title="Aperçu du poste" href="%s" onclick="return showAddAnotherPopup(this);" title="Aperçu du poste"><img src="%simg/loupe.png" /></a><a href="%s">Poste</a> """ % \
+ ( reverse('poste_apercu', args=(d.poste.id,)),
+ settings.STATIC_URL,
+ reverse('admin:rh_poste_change', args=(d.poste.id,))
+ )
+ link = u"""<li>%s %s - %s : [%s] %s</li>""" % \
+ (dossier, poste,
d.date_debut.year,
- d.poste,
+ d.poste.id,
+ d.poste.nom,
)
# Dossier terminé en gris non cliquable
if d.date_fin is not None:
- link = u"""<li style="color: grey">%s : %s</li>""" % \
+ link = u"""<li style="color: grey">%s : [%s] %s</li>""" % \
(d.date_debut.year,
- d.poste,
+ d.poste.id,
+ d.poste.nom,
)
l.append(link)
return "<ul>%s</ul>" % "\n".join(l)
- _dossiers.allow_tags = True
- _dossiers.short_description = u"Dossiers"
+ _dossiers_postes.allow_tags = True
+ _dossiers_postes.short_description = u"Dossiers et postes"
def queryset(self, request):
qs = super(EmployeAdmin, self).queryset(request)