def get_context_data(self, **kwargs): context = super(NormaPesquisaView, self).get_context_data(**kwargs) context['title'] = _('Pesquisar Norma Jurídica') self.filterset.form.fields['o'].label = _('Ordenação') qs = self.object_list if 'o' in self.request.GET and not self.request.GET['o']: qs = qs.order_by('-ano', 'tipo', '-numero') qr = self.request.GET.copy() if 'page' in qr: del qr['page'] paginator = context['paginator'] page_obj = context['page_obj'] context['page_range'] = make_pagination(page_obj.number, paginator.num_pages) context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' context['show_results'] = show_results_filter_set(qr) context['USE_SOLR'] = settings.USE_SOLR if hasattr( settings, 'USE_SOLR') else False return context
def get_context_data(self, **kwargs): context = super(ListarUsuarioView, self).get_context_data(**kwargs) paginator = context['paginator'] page_obj = context['page_obj'] context['page_range'] = make_pagination(page_obj.number, paginator.num_pages) context['NO_ENTRIES_MSG'] = 'Nenhum usuário cadastrado.' return context
def get_context_data(self, **kwargs): context = super(ProtocoloListView, self).get_context_data(**kwargs) paginator = context['paginator'] page_obj = context['page_obj'] context['page_range'] = make_pagination(page_obj.number, paginator.num_pages) return context
def get_context_data(self, **kwargs): context = super(ProtocoloListView, self).get_context_data( **kwargs) paginator = context['paginator'] page_obj = context['page_obj'] context['page_range'] = make_pagination( page_obj.number, paginator.num_pages) return context
def get_context_data(self, **kwargs): context = super(PesquisarDocumentoAdministrativoView, self).get_context_data(**kwargs) paginator = context['paginator'] page_obj = context['page_obj'] context['page_range'] = make_pagination( page_obj.number, paginator.num_pages) return context
def get_context_data(self, **kwargs): context = super(PesquisarDocumentoAdministrativoView, self).get_context_data(**kwargs) paginator = context['paginator'] page_obj = context['page_obj'] context['page_range'] = make_pagination(page_obj.number, paginator.num_pages) return context
def get_context_data(self, **kwargs): context = super(ProtocoloPesquisaView, self).get_context_data(**kwargs) paginator = context['paginator'] page_obj = context['page_obj'] context['page_range'] = make_pagination(page_obj.number, paginator.num_pages) context['title'] = _('Pesquisa de Protocolos') return context
def get_context_data(self, **kwargs): context = super(ProtocoloPesquisaView, self).get_context_data(**kwargs) paginator = context['paginator'] page_obj = context['page_obj'] context['page_range'] = make_pagination( page_obj.number, paginator.num_pages) context['title'] = _('Pesquisa de Protocolos') return context
def get_context_data(self, **kwargs): context = super(PesquisarParlamentarView, self).get_context_data(**kwargs) paginator = context['paginator'] page_obj = context['page_obj'] context['page_range'] = make_pagination(page_obj.number, paginator.num_pages) context['NO_ENTRIES_MSG'] = 'Nenhum parlamentar encontrado!' context['title'] = _('Parlamentares') return context
def get_context_data(self, **kwargs): count = self.object_list.count() context = super(ImpressoEnderecamentoContatoView, self).get_context_data(**kwargs) context['count'] = count context['title'] = _('Impressão de Etiquetas e Envelopes') paginator = context['paginator'] page_obj = context['page_obj'] 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 '' return context
def get_context_data(self, **kwargs): context = super(NormaPesquisaView, self).get_context_data(**kwargs) context['title'] = _('Pesquisar Norma Jurídica') qr = self.request.GET.copy() if 'page' in qr: del qr['page'] paginator = context['paginator'] page_obj = context['page_obj'] context['page_range'] = make_pagination( page_obj.number, paginator.num_pages) context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' return context
def get_context_data(self, **kwargs): context = super(NormaPesquisaView, self).get_context_data(**kwargs) context['title'] = _('Pesquisar Norma Jurídica') qr = self.request.GET.copy() if 'page' in qr: del qr['page'] paginator = context['paginator'] page_obj = context['page_obj'] context['page_range'] = make_pagination(page_obj.number, paginator.num_pages) context['filter_url'] = ('&' + qr.urlencode()) if len(qr) > 0 else '' return context
def get_context_data(self, **kwargs): count = self.object_list.count() context = super(RelatorioContatoAgrupadoPorProcessoView, self).get_context_data(**kwargs) context['count'] = count context['title'] = _( 'Relatório de Contatos Com Agrupamento Por Processos') paginator = context['paginator'] page_obj = context['page_obj'] 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 '' return context
def test_make_pagination(index, num_pages, result): assert num_pages < 10 or len(result) == 10 assert make_pagination(index, num_pages) == result