def get_datatable(self, type=None): """ Customized implementation of the structure getter. The custom argument ``type`` is managed by us, and is used in the context and GET parameters to control which table we return. """ if type is None: type = self.request.GET.get('datatable-type', None) if type is not None: datatable_options = self.get_datatable_options(type=type) # Put a marker variable in the AJAX GET request so that the table identity is known ajax_url = self.request.path + "?datatable-type={type}".format( type=type) if type == "demo2": datatable = get_datatable_structure(ajax_url, datatable_options, model=Entry) elif type == "demo3": # Change the reference model to Blog, instead of Entry datatable = get_datatable_structure(ajax_url, datatable_options, model=Blog) else: return super(MultipleTablesDatatableView, self).get_datatable() return datatable
def get_datatable(self): """ Returns the helper object that can be used in the template to render the datatable skeleton. """ options = self._get_datatable_options() return get_datatable_structure(self.request.path, self.model, options)
def get_context_data(self, **kwargs): context = super(EmbeddedTableDatatableView, self).get_context_data(**kwargs) satellite_view = SatelliteDatatableView() options = satellite_view.get_datatable_options() datatable = get_datatable_structure(reverse('satellite'), options) context['datatable'] = datatable return context
def get_datatable(self, type=None): """ Customized implementation of the structure getter. The custom argument ``type`` is managed by us, and is used in the context and GET parameters to control which table we return. """ if type is None: type = self.request.GET.get('datatable-type', None) if type is not None: datatable_options = self.get_datatable_options(type=type) # Put a marker variable in the AJAX GET request so that the table identity is known ajax_url = self.request.path + "?datatable-type={type}".format(type=type) if type == "demo2": datatable = get_datatable_structure(ajax_url, datatable_options, model=Entry) elif type == "demo3": # Change the reference model to Blog, instead of Entry datatable = get_datatable_structure(ajax_url, datatable_options, model=Blog) else: return super(MultipleTablesDatatableView, self).get_datatable() return datatable