[#2380] Réorganisation des modèles dans le dashboard de l'app RH comment le principal
authorPA Parent <paparent@paparent.me>
Tue, 6 Dec 2011 14:00:20 +0000 (09:00 -0500)
committerPA Parent <paparent@paparent.me>
Tue, 6 Dec 2011 14:00:20 +0000 (09:00 -0500)
project/dashboard.py
project/settings.py

index 7ee06b8..6f9bc0a 100644 (file)
@@ -77,3 +77,78 @@ 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.Employe',
+            '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
+        ))
index e6b53bf..f302ef6 100644 (file)
@@ -111,6 +111,7 @@ TEMPLATE_DIRS = (
 
 
 ADMIN_TOOLS_INDEX_DASHBOARD = 'project.dashboard.CustomIndexDashboard'
+ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'project.dashboard.CustomAppIndexDashboard'
 
 AJAX_LOOKUP_CHANNELS = {
     'responsables' : ('dae.catalogues', 'Responsable'),