def get_context(self): context = super().get_context() #context['title'] = _('Pesquisa Textual') if 'models' in self.request.GET: models = self.request.GET.getlist('models') else: models = [] context['models'] = '' context['is_paginated'] = True page_obj = context['page'] context['page_obj'] = page_obj paginator = context['paginator'] context['page_range'] = make_pagination(page_obj.number, paginator.num_pages) qr = self.request.GET.copy() if 'page' in qr: del qr['page'] context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' for m in models: context['models'] = context['models'] + '&models=' + m return context
def get_context(self): context = super().get_context() #context['title'] = _('Pesquisa Textual') data = self.request.GET or self.request.POST data = data.copy() if 'csrfmiddlewaretoken' in data: del data['csrfmiddlewaretoken'] if 'models' in data: models = data.getlist('models') else: models = [] context['models'] = '' context['is_paginated'] = True page_obj = context['page'] context['page_obj'] = page_obj paginator = context['paginator'] context['page_range'] = make_pagination(page_obj.number, paginator.num_pages) if 'page' in data: del data['page'] context['filter_url'] = ('&' + data.urlencode()) if len(data) > 0 else '' for m in models: context['models'] = context['models'] + '&models=' + m return context
def get_context_data_classe(self, **kwargs): template = self.classe.template_classe if template == models.CLASSE_TEMPLATES_CHOICE.lista_em_linha: kwargs['object_list'] = self.classe.documento_set.qs_news( user=self.request.user) elif template == models.CLASSE_TEMPLATES_CHOICE.galeria: kwargs['object_list'] = Documento.objects.view_public_gallery() elif template == models.CLASSE_TEMPLATES_CHOICE.fotografia: kwargs['object_list'] = self.classe.documento_set.qs_bi( self.request.user) elif template == models.CLASSE_TEMPLATES_CHOICE.galeria_audio: kwargs['object_list'] = self.classe.documento_set.qs_audio_news( self.request.user) elif template == models.CLASSE_TEMPLATES_CHOICE.galeria_video: kwargs['object_list'] = self.classe.documento_set.qs_video_news( self.request.user) elif template == models.CLASSE_TEMPLATES_CHOICE.parlamentar: docs = self.classe.parlamentar.documento_set kwargs['object_list'] = docs.qs_news(self.request.user) elif models.CLASSE_TEMPLATES_CHOICE.documento_especifico: kwargs['object_list'] = Documento.objects.qs_news().filter( parlamentares__isnull=True)[:4] self.object_list = kwargs['object_list'] context = super().get_context_data(**kwargs) if self.paginate_by: page_obj = context['page_obj'] paginator = context['paginator'] context['page_range'] = make_pagination(page_obj.number, paginator.num_pages) if self.classe.capa: context['object'] = self.classe.capa self.template_name = models.DOC_TEMPLATES_CHOICE_FILES[ self.classe.capa.template_doc]['template_name'] else: context['object'] = self.classe context['create_doc_url'] = models.DOC_TEMPLATES_CHOICE_FILES[ self.classe.template_doc_padrao]['create_url'] return context
def get_context_data_classe(self, **kwargs): template = self.classe.template_classe if template == models.CLASSE_TEMPLATES_CHOICE.lista_em_linha: kwargs['object_list'] = self.classe.documento_set.qs_news( user=self.request.user) elif template == models.CLASSE_TEMPLATES_CHOICE.galeria: kwargs['object_list'] = Documento.objects.view_public_gallery() elif template == models.CLASSE_TEMPLATES_CHOICE.fotografia: kwargs['object_list'] = self.classe.documento_set.qs_bi( self.request.user) elif template == models.CLASSE_TEMPLATES_CHOICE.galeria_audio: kwargs['object_list'] = self.classe.documento_set.qs_audio_news( self.request.user) elif template == models.CLASSE_TEMPLATES_CHOICE.galeria_video: kwargs['object_list'] = self.classe.documento_set.qs_video_news( self.request.user) elif template == models.CLASSE_TEMPLATES_CHOICE.parlamentar: docs = self.classe.parlamentar.documento_set kwargs['object_list'] = docs.qs_news(self.request.user) elif models.CLASSE_TEMPLATES_CHOICE.documento_especifico: kwargs['object_list'] = Documento.objects.qs_news().filter( parlamentares__isnull=True)[:4] self.object_list = kwargs['object_list'] context = super().get_context_data(**kwargs) if self.paginate_by: page_obj = context['page_obj'] paginator = context['paginator'] context['page_range'] = make_pagination( page_obj.number, paginator.num_pages) if self.classe.capa: context['object'] = self.classe.capa else: context['object'] = self.classe context['create_doc_url'] = models.DOC_TEMPLATES_CHOICE_FILES[ self.classe.template_doc_padrao]['create_url'] return context
def get_context_data(self, **kwargs): count = self.object_list.count() context = super().get_context_data(**kwargs) context['count'] = count # pagination if self.paginate_by: page_obj = context['page_obj'] paginator = context['paginator'] context['page_range'] = make_pagination(page_obj.number, paginator.num_pages) # rows object_list = context['object_list'] context['NO_ENTRIES_MSG'] = self.no_entries_msg context['subnav_template_name'] = 'ouvidoria/subnav_list.yaml' return context
def get_context_data(self, **kwargs): count = self.object_list.count() context = super().get_context_data(**kwargs) context['count'] = count # pagination if self.paginate_by: page_obj = context['page_obj'] paginator = context['paginator'] context['page_range'] = make_pagination( page_obj.number, paginator.num_pages) # rows object_list = context['object_list'] context['NO_ENTRIES_MSG'] = self.no_entries_msg context['subnav_template_name'] = 'ouvidoria/subnav_list.yaml' return context