znotdead avatar znotdead committed 74ee035

adding extra urls to ModelList module of dashboard

Comments (0)

Files changed (1)

admin_tools/dashboard/modules.py

         self.exclude = list(exclude or [])
         self.include_list = kwargs.pop('include_list', []) # deprecated
         self.exclude_list = kwargs.pop('exclude_list', []) # deprecated
+        if 'extra' in kwargs:
+            self.extra = kwargs.pop('extra')
+        else:
+            self.extra = []
         super(ModelList, self).__init__(title, **kwargs)
 
     def init_with_context(self, context):
             if perms['add']:
                 model_dict['add_url'] = self._get_admin_add_url(model, context)
             self.children.append(model_dict)
+        if self.extra:
+            # TODO - permissions support
+            for extra_url in self.extra:
+                model_dict = {}
+                model_dict['title'] = extra_url['title']
+                model_dict['change_url'] = extra_url['change_url']
+                model_dict['add_url'] = extra_url.get('add_url', None)
+                self.children.append(model_dict)
+
+
         self._initialized = True
 
 
                 pass
             self.children.append(entry)
         self._initialized = True
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.