From: Olivier Larchevêque Date: Fri, 10 Feb 2012 22:18:41 +0000 (-0500) Subject: Merge branch 'dev' of ssh://git.auf.org/auf_rh_dae into dev X-Git-Tag: DAE+RH~82 X-Git-Url: https://git.auf.org/?p=auf_rh_dae.git;a=commitdiff_plain;h=95f9feb6244fedf53d3e676d77d0e35c061e9e33;hp=d48f0922b76aca02764dfa37bcb6925fcc13d0e1 Merge branch 'dev' of ssh://git.auf.org/auf_rh_dae into dev --- diff --git a/project/rh/admin.py b/project/rh/admin.py index 2269dd9..6c12274 100644 --- a/project/rh/admin.py +++ b/project/rh/admin.py @@ -275,6 +275,8 @@ class DossierAdmin(DateRangeMixin, AUFMetadataAdminMixin, ProtectRegionMixin, ad search_fields = ('employe__nom', 'employe__prenom', 'poste__nom', 'poste__nom_feminin') list_display = ( '_id', + '_apercu', + '_nom', '_poste', '_employe', '_date_debut', @@ -282,6 +284,7 @@ class DossierAdmin(DateRangeMixin, AUFMetadataAdminMixin, ProtectRegionMixin, ad '_date_modification', 'user_modification', ) + list_display_links = ('_nom',) list_filter = ( 'poste__implantation__region', 'poste__implantation', @@ -330,20 +333,26 @@ class DossierAdmin(DateRangeMixin, AUFMetadataAdminMixin, ProtectRegionMixin, ad ): return True - def _id(self, d): + def _id(self, obj): + return obj.id + _id.short_description = u"#" + _id.admin_order_field = "id" + + def _nom(self, obj): + return "%d : %s %s" % \ + (obj.date_debut.year, obj.employe.nom.upper(), obj.employe.prenom) + _nom.allow_tags = True + _nom.short_description = u"Dossier" + + + def _apercu(self, d): apercu_link = u"""""" % \ (reverse('dossier_apercu', args=(d.id,)), settings.STATIC_URL, ) - link = u"""%s %s""" % \ - (apercu_link, - reverse('admin:rh_dossier_change', args=(d.id,)), - d.id, - ) - return link - _id.allow_tags = True - _id.short_description = u"Dossier #" - _id.admin_order_field = 'id' + return apercu_link + _apercu.allow_tags = True + _apercu.short_description = u"" def _date_debut(self, obj): @@ -385,7 +394,7 @@ class DossierAdmin(DateRangeMixin, AUFMetadataAdminMixin, ProtectRegionMixin, ad return u"""%s%s""" % \ (view, edit_link, style, employe) _employe.allow_tags = True - _employe.short_description = u"Employé (NOM Prénom [code])" + _employe.short_description = u"Employé" _employe.admin_order_field = "employe__nom" def save_formset(self, request, form, formset, change): @@ -411,7 +420,8 @@ class EmployeAdmin(DateRangeMixin, AUFMetadataAdminMixin, ProtectRegionMixin, ad search_fields = ('id', 'nom', 'prenom', 'nom_affichage', ) ordering = ('nom', ) form = EmployeAdminForm - list_display = ('_apercu', '_nom', '_dossiers', '_date_modification', 'user_modification', ) + list_display = ('_id', '_apercu', '_nom', '_dossiers', '_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_borne_droite = 'rh_dossiers__date_fin' @@ -436,16 +446,20 @@ class EmployeAdmin(DateRangeMixin, AUFMetadataAdminMixin, ProtectRegionMixin, ad (reverse('employe_apercu', args=(obj.id,)), settings.STATIC_URL) _apercu.allow_tags = True _apercu.short_description = u"" - _apercu.admin_order_field = "" def _nom(self, obj): edit_link = reverse('admin:rh_employe_change', args=(obj.id,)) return u"""%s""" % \ - (edit_link, obj) + (edit_link, "%s %s" % (obj.nom.upper(), obj.prenom)) _nom.allow_tags = True - _nom.short_description = u"Employé (NOM Prénom [code])" + _nom.short_description = u"Employé" _nom.admin_order_field = "nom" + def _id(self, obj): + return obj.id + _id.short_description = u"#" + _id.admin_order_field = "id" + def _date_modification(self, obj): return date(obj.date_modification) if obj.date_modification is not None else "(aucune)" _date_modification.short_description = u'date modification' @@ -546,6 +560,7 @@ class PosteAdmin(DateRangeMixin, AUFMetadataAdminMixin, ProtectRegionMixin, admi 'rh_dossiers__employe__prenom', ) list_display = ( + '_id', '_apercu', '_nom', '_occupe_par', @@ -566,6 +581,7 @@ class PosteAdmin(DateRangeMixin, AUFMetadataAdminMixin, ProtectRegionMixin, admi 'date_fin', 'vacant', ) + list_display_links = ('_nom',) fieldsets = AUFMetadataAdminMixin.fieldsets + ( (None, { 'fields': (('nom', 'nom_feminin'), 'implantation', 'type_poste', @@ -627,20 +643,23 @@ class PosteAdmin(DateRangeMixin, AUFMetadataAdminMixin, ProtectRegionMixin, admi (reverse('poste_apercu', args=(poste.id,)), settings.STATIC_URL, ) - edit_link = u"""%s""" % \ - (reverse('admin:rh_poste_change', args=(poste.id,)), - poste.id, - ) - return view_link + edit_link + return view_link _apercu.allow_tags = True - _apercu.short_description = 'Poste __#' - _apercu.admin_order_field = 'id' + _apercu.short_description = '' + + def _id(self, obj): + return "%s" % obj.id + _id.short_description = '#' + _id.admin_order_field = 'id' def _service(self, obj): return obj.service def _nom(self, poste): - return poste.nom + return """%s""" % \ + (reverse('admin:rh_poste_change', args=(poste.id,)), + poste.nom + ) _nom.allow_tags = True _nom.short_description = u'Nom' _nom.admin_order_field = 'nom'