Merge branch 'master' into recrutement
authorPA Parent <paparent@paparent.me>
Tue, 10 Jul 2012 17:56:10 +0000 (13:56 -0400)
committerPA Parent <paparent@paparent.me>
Tue, 10 Jul 2012 17:56:10 +0000 (13:56 -0400)
Conflicts:
project/recrutement/admin.py

1  2 
project/dashboard.py
project/recrutement/admin.py
project/recrutement/views.py
project/settings.py
versions.cfg

@@@ -17,48 -20,56 +20,79 @@@ from project.rh.historique import get_a
  
  class CustomIndexDashboard(Dashboard):
      """
 -    Custom index dashboard for SIGMA.
 +    Custom index dashboard for SGRH.
      """
      def init_with_context(self, context):
+         request = context['request']
  
          # append an app list module for "Applications"
 -        self.children.append(modules.AppList(
 +        self.children.append(modules.Group(
              _('Applications'),
 -            models=(
 -                'project.dae.models.*',
 -                'project.recrutement.models.*',
 -                'project.rh.models.AyantDroit',
 -                'project.rh.models.Dossier',
 -                'project.rh.models.DossierInactif',
 -                'project.rh.models.Employe',
 -                'project.rh.models.EmployeInactif',
 -                'project.rh.models.Poste',
 -            ),
 +            display='stacked',
 +            children=[
 +                modules.ModelList(
 +                    title='Demande d\'autorisation d\'engagement',
 +                    models=(
 +                        'project.dae.models.*',
 +                    )
 +                ),
 +                modules.ModelList(
 +                    title='Gestion des candidatures',
 +                    models=(
 +                        'auf.django.emploi.models.OffreEmploi',
 +                        'project.recrutement.models.ProxyOffreEmploi',
 +                        'auf.django.emploi.models.Candidat',
 +                        'project.recrutement.models.ProxyCandidat',
 +                        'project.recrutement.models.CandidatEvaluation',
 +                        'project.recrutement.models.MesCandidatEvaluation',
 +                        'project.recrutement.models.Evaluateur',
 +                        'project.recrutement.models.CourrielTemplate',
 +                    )
 +                ),
 +                modules.ModelList(
 +                    title='Gestion des personnels',
 +                    models=(
 +                        'project.rh.models.AyantDroit',
 +                        'project.rh.models.Dossier',
 +                        'project.rh.models.DossierInactif',
 +                        'project.rh.models.Employe',
 +                        'project.rh.models.EmployeInactif',
 +                        'project.rh.models.Poste',
 +                    )
 +                ),
 +            ]
          ))
  
+         if in_drh_or_admin(request.user):
+             revisions = get_active_revisions()[:10]
+             children = []
+             for rev in revisions:
+                 date = rev['short_date_created']
+                 user = u"<span style='font-weight: bold;'>%s</span>" % rev['user']
+                 if rev['type'] is None or rev['objet'] is None:
+                     titre = u"""<span style='color:black;'>[%s] %s</span>
+                     commentaire : %s """ % (date, user, rev['comment'])
+                     children.append({
+                         'title': titre,
+                         'url': reverse('rhr_historique_des_modifications'),
+                         'external': False,
+                         })
+                 else:
+                     type = u"<span style='font-decoration: underligne;'>%s</span>" % rev['type']
+                     titre = u"""<span style='color:black;'>[%s] %s a modifié
+                         un(e) %s :</span> %s""" % (date, user, type, rev['objet'], )
+                     children.append({
+                         'title': titre,
+                         'url': rev['history_url'],
+                         'external': False,
+                         })
+             self.children.append(modules.LinkList(
+                 title='10 dernières modifications',
+                 children=children,)
+             )
          # append an app list module for "Configuration"
          self.children.append(modules.AppList(
              _('Configuration'),
@@@ -15,13 -13,8 +17,12 @@@ from django.http import HttpResponseRed
  from django.shortcuts import redirect
  from reversion.admin import VersionAdmin
  
 +from auf.django.emploi.models import OffreEmploi, Candidat, CandidatPiece
 +from auf.django.references.models import Region, Bureau, Implantation
 +from auf.django.export.admin import ExportAdmin
 +
  from project.groups import get_employe_from_user as get_emp
  from project.rh import models as rh
  from project.recrutement.forms import OffreEmploiForm
  from project.recrutement.groups import \
          grp_drh, grp_drh2, \
@@@ -93,7 -67,7 +93,7 @@@ class OffreEmploiAdminMixin(BaseAdmin)
  
      ### Actions à afficher
      def get_actions(self, request):
--        actions = super(OffreEmploiAdmin, self).get_actions(request)
++        actions = super(OffreEmploiAdminMixin, self).get_actions(request)
          del actions['delete_selected']
          return actions
  
  
      ### Formulaire
      def get_form(self, request, obj=None, **kwargs):
--        form = super(OffreEmploiAdmin, self).get_form(request, obj, **kwargs)
++        form = super(OffreEmploiAdminMixin, self).get_form(request, obj, **kwargs)
          employe = get_emp(request.user)
          user_groupes = request.user.groups.all()
  
              return True
          return False
  
 +    def formfield_for_foreignkey(self, db_field, request, **kwargs):
 +        if db_field.name == 'lieu_affectation':
 +            employe = get_emp(request.user)
 +            kwargs["queryset"] = Implantation.objects.filter(region=employe.implantation.region)
 +            return db_field.formfield(**kwargs)
-         return super(OffreEmploiAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
++        return super(OffreEmploiAdminMixin, self).formfield_for_foreignkey(db_field, request, **kwargs)
++
  
+ class OffreEmploiAdmin(VersionAdmin, OffreEmploiAdminMixin):
+     pass
  
- class ProxyOffreEmploiAdmin(OffreEmploiAdmin):
+ class ProxyOffreEmploiAdmin(OffreEmploiAdminMixin):
      list_display = (
          'nom', 'date_limite', 'region', 'statut', 'est_affiche'
      )
@@@ -325,8 -306,8 +329,9 @@@ class CandidatEvaluationInline(admin.Ta
              return self.readonly_fields + ('evaluateur', 'note', 'commentaire')
          return self.readonly_fields
  
- class CandidatAdmin(BaseAdmin, VersionAdmin, ExportAdmin):
 -class CandidatAdminMixin(BaseAdmin):
++class CandidatAdminMixin(BaseAdmin, ExportAdmin):
 +    change_list_template = 'admin/recrutement/candidat/change_list.html'
      search_fields = ('nom', 'prenom')
      exclude = ('actif', )
      list_editable = ('statut', )
  
      ### Actions à afficher
      def get_actions(self, request):
--        actions = super(CandidatAdmin, self).get_actions(request)
++        actions = super(CandidatAdminMixin, self).get_actions(request)
          del actions['delete_selected']
          return actions
  
              return True
          return False
  
 +    def formfield_for_foreignkey(self, db_field, request, **kwargs):
 +        if db_field.name == 'offre_emploi':
 +            employe = get_emp(request.user)
 +            kwargs["queryset"] = OffreEmploi.objects.filter(region=employe.implantation.region)
 +            return db_field.formfield(**kwargs)
-         return super(CandidatAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
++        return super(CandidatAdminMixin, self).formfield_for_foreignkey(db_field, request, **kwargs)
 +
      def get_changelist(self, request, **kwargs):
          return OrderedChangeList
  
@@@ -113,13 -108,12 +108,12 @@@ def affecter_evaluateurs_offre_emploi(r
                  request, messages.SUCCESS,
                  "Les évaluateurs ont été affectés aux offres d'emploi."
              )
 -            return redirect("admin:recrutement_proxyoffreemploi_changelist")
 +            return redirect("admin:emploi_offreemploi_changelist")
      else:
          form = forms.EvaluateurForm(offres_emploi=offres_emploi)
-     c = {
-         'form': form,
-     }
-     return render(request, "recrutement/affecter_evaluateurs.html", c)
+     return render(request, "recrutement/affecter_evaluateurs.html", {
+         'form': form
+     })
  
  
  def send_templated_email(candidat, template):
Simple merge
diff --cc versions.cfg
Simple merge