diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index fef41ce94..e2e20a01f 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -12,6 +12,7 @@ from django.utils.decorators import method_decorator from django.utils.html import strip_tags from django.utils.translation import ugettext_lazy as _ from django.views.generic import ListView, TemplateView +from django.views.generic.base import RedirectView from django.views.generic.detail import DetailView from django.views.generic.edit import FormMixin from django_filters.views import FilterView @@ -45,6 +46,7 @@ from .models import (Bancada, Bloco, CargoBancada, CargoMesa, SessaoPlenariaPresenca, TipoExpediente, TipoResultadoVotacao, TipoSessaoPlenaria, VotoParlamentar) + # OrdemDiaCrud = Crud.build(OrdemDia, '') # RegistroVotacaoCrud = Crud.build(RegistroVotacao, '') TipoSessaoCrud = CrudAux.build(TipoSessaoPlenaria, 'tipo_sessao_plenaria') @@ -427,8 +429,27 @@ class SessaoCrud(Crud): list_field_names = ['data_inicio', 'legislatura', 'sessao_legislativa', 'tipo'] - class ListView(Crud.ListView): - ordering = ['-data_inicio'] + @property + def list_url(self): + return '' + + @property + def cancel_url(self): + return self.search_url + + @property + def search_url(self): + namespace = self.model._meta.app_config.name + return reverse('%s:%s' % (namespace, 'pesquisar_sessao')) + + class ListView(Crud.ListView, RedirectView): + + def get_redirect_url(self, *args, **kwargs): + namespace = self.model._meta.app_config.name + return reverse('%s:%s' % (namespace, 'pesquisar_sessao')) + + def get(self, request, *args, **kwargs): + return RedirectView.get(self, request, *args, **kwargs) class CreateView(Crud.CreateView): diff --git a/sapl/templates/crud/detail.html b/sapl/templates/crud/detail.html index 1eab8100c..af0c8c05a 100644 --- a/sapl/templates/crud/detail.html +++ b/sapl/templates/crud/detail.html @@ -9,6 +9,9 @@ {% if view.list_url %} {% trans 'Listar' %} {{view.verbose_name_plural}} {% endif %} + {% if view.search_url %} + {% trans 'Fazer Nova Pesquisa' %} + {% endif %} {% if view.create_url %} {% blocktrans with verbose_name=view.verbose_name %} Adicionar {{ verbose_name }} {% endblocktrans %} diff --git a/sapl/templates/sessao/sessaoplenaria_filter.html b/sapl/templates/sessao/sessaoplenaria_filter.html index 5069735c7..b4aa4ca98 100644 --- a/sapl/templates/sessao/sessaoplenaria_filter.html +++ b/sapl/templates/sessao/sessaoplenaria_filter.html @@ -6,7 +6,7 @@ {% if perms.sessao %} - {% blocktrans with verbose_name=view.verbose_name %} Adicionar Sessão Plenária {% endblocktrans %} + {% blocktrans with verbose_name=view.verbose_name %} Adicionar Sessão Plenária {% endblocktrans %} {% endif %} {% if filter_url %} @@ -50,4 +50,4 @@ {% endif %} {% endblock detail_content %} {% block table_content %} -{% endblock table_content %} \ No newline at end of file +{% endblock table_content %}