2 plugins - same query
[unfold.git] / trash / dashboard.py
index 35eeb33..297133e 100644 (file)
@@ -10,11 +10,10 @@ from django.contrib.auth.decorators import login_required
 from engine.pluginset import PluginSet
 from engine.manifoldquery import ManifoldQuery
 
-from plugins.simplelist import SimpleList
+from plugins.slicelist import SliceList
 
 # 
 from myslice.viewutils import topmenu_items, the_user
-# from myslice.viewutils import hard_wired_slice_names, hard_wired_list, lorem_p, lorem, quickfilter_criterias
 
 @login_required
 def dashboard_view (request):
@@ -28,19 +27,18 @@ def dashboard_view (request):
                                   # xxx filter : should filter on the slices the logged user can see
                                   # we don't have the user's hrn yet
                                   # in addition this currently returns all slices anyways
+                                  # filter = ...
                                   sort='slice_hrn',)
     pluginset.enqueue_query (slices_query)
 
-    main_plugin = SimpleList ( # setting visible attributes first
+    main_plugin = SliceList ( # setting visible attributes first
         pluginset=pluginset,
-        title='Asynchroneous SimpleList',
+        title='Asynchroneous SliceList',
         header='slices list', 
-        with_datatables=True,
+        with_datatables=False,
         toggled=True,
-        # this is required for the javascript code
+        # this is the query at the core of the slice list
         query=slices_query,
-        key='slice_hrn',
-        value='slice_hrn',
         )
 
     # variables that will get passed to the view-plugin.html template
@@ -65,8 +63,29 @@ def dashboard_view (request):
     # so we can sho who is logged
     template_env [ 'username' ] = the_user (request) 
 
+    ##########
+    # lacks a/href to /slice/%s
+    related_plugin = SliceList (
+        pluginset=pluginset,
+        title='Same request, other layout',
+        domid='sidelist',
+        with_datatables=True, 
+        header='paginated slices',
+        # share the query
+        query=slices_query,
+        )
+    # likewise but on the side view
+    template_env [ 'content_related' ] = related_plugin.render (request)
+    
+    # add our own css in the mix
+    pluginset.add_css_files ( 'css/dashboard.css')
+    
+    # don't forget to run the requests
     pluginset.exec_queue_asynchroneously ()
 
+    # xxx create another plugin with the same query and a different layout (with_datatables)
+    # show that it worls as expected, one single api call to backend and 2 refreshed views
+
     # the prelude object in pluginset contains a summary of the requirements() for all plugins
     # define {js,css}_{files,chunks}
     prelude_env = pluginset.template_env()