class FilemanagerMixin(object): def dispatch(self, request, *args, **kwargs): params = dict(request.GET) params.update(dict(request.POST)) self.fm = Filemanager() if 'path' in params and len(params['path'][0]) > 0: self.fm.update_path(params['path'][0]) if 'popup' in params: self.popup = params['popup'] self.message = '' if request.session and 'message' in request.session: self.message = request.session['message'] request.session['message'] = '' return super(FilemanagerMixin, self).dispatch(request, *args, **kwargs) def get_context_data(self, *args, **kwargs): context = super(FilemanagerMixin, self).get_context_data(*args, **kwargs) self.fm.patch_context_data(context) if hasattr(self, 'popup'): context['popup'] = self.popup if hasattr(self, 'extra_breadcrumbs') and isinstance(self.extra_breadcrumbs, list): context['breadcrumbs'] += self.extra_breadcrumbs return context
def dispatch(self, request, *args, **kwargs): params = dict(request.GET) params.update(dict(request.POST)) self.fm = Filemanager() if 'path' in params and len(params['path'][0]) > 0: self.fm.update_path(params['path'][0]) if 'popup' in params: self.popup = params['popup'] return super(FilemanagerMixin, self).dispatch(request, *args, **kwargs)