dae+rh
[auf_rh_dae.git] / project / dashboard.py
index 7ee06b8..1be4380 100644 (file)
@@ -34,7 +34,9 @@ class CustomIndexDashboard(Dashboard):
             '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',
             ),
         ))
@@ -57,6 +59,7 @@ class CustomIndexDashboard(Dashboard):
             'project.rh.models.TypeRemuneration',
             'project.rh.models.ValeurPoint',
             ),
+            exclude=('django.contrib.*',),
         ))
 
         # append an app list module for "Inter-systèmes"
@@ -77,3 +80,80 @@ class CustomIndexDashboard(Dashboard):
 
         # append a recent actions module
         self.children.append(modules.RecentActions(_('Recent Actions'), 5))
+
+
+class CustomAppIndexDashboard(AppIndexDashboard):
+    """
+    Custom app index dashboard for project.
+    """
+
+    # we disable title because its redundant with the model list module
+    title = ''
+
+    def __init__(self, *args, **kwargs):
+        AppIndexDashboard.__init__(self, *args, **kwargs)
+
+    def init_with_context(self, context):
+        """
+        Use this method if you need to access the request context.
+        """
+        if self.app_title != 'Rh':
+            # append a model list module and a recent actions module
+            self.children += [
+                modules.ModelList(self.app_title,self.models),
+                modules.RecentActions(
+                    _('Recent Actions'),
+                    include_list=self.get_app_content_types(),
+                    limit=5
+                )
+            ]
+
+            return
+
+        # append an app list module for "Application"
+        self.children.append(modules.AppList(
+            _('Application'),
+            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',
+            ),
+        ))
+
+        # append an app list module for "Configuration"
+        self.children.append(modules.AppList(
+            _('Configuration'),
+            models=(
+            'project.rh.models.Classement',
+            'project.rh.models.Devise',
+            'project.rh.models.FamilleEmploi',
+            'project.rh.models.OrganismeBstg',
+            'project.rh.models.Responsable',
+            'project.rh.models.Service',
+            'project.rh.models.Statut',
+            'project.rh.models.TauxChange',
+            'project.rh.models.TypeContrat',
+            'project.rh.models.TypePoste',
+            'project.rh.models.TypeRevalorisation',
+            'project.rh.models.TypeRemuneration',
+            'project.rh.models.ValeurPoint',
+            ),
+        ))
+
+        # append an app list module for "Inter-systèmes"
+        self.children.append(modules.AppList(
+            _(u'Inter-systèmes'),
+            models=(
+            'project.rh.models.ResponsableImplantation',
+            ),
+        ))
+
+        # append a recent actions module
+        self.children.append(modules.RecentActions(
+            _('Recent Actions'),
+            include_list=self.get_app_content_types(),
+            limit=5
+        ))