Browse Source

Fix #683 e #690

pull/701/head
LeandroRoberto 8 years ago
parent
commit
80783c1ed5
  1. 25
      sapl/sessao/views.py
  2. 3
      sapl/templates/crud/detail.html
  3. 4
      sapl/templates/sessao/sessaoplenaria_filter.html

25
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):

3
sapl/templates/crud/detail.html

@ -9,6 +9,9 @@
{% if view.list_url %}
<a href="{{ view.list_url }}" class="btn btn-default">{% trans 'Listar' %} {{view.verbose_name_plural}}</a>
{% endif %}
{% if view.search_url %}
<a href="{{ view.search_url }}" class="btn btn-default">{% trans 'Fazer Nova Pesquisa' %}</a>
{% endif %}
{% if view.create_url %}
<a href="{{ view.create_url }}" class="btn btn-default">
{% blocktrans with verbose_name=view.verbose_name %} Adicionar {{ verbose_name }} {% endblocktrans %}

4
sapl/templates/sessao/sessaoplenaria_filter.html

@ -6,7 +6,7 @@
<div class="actions btn-group pull-right" role="group">
{% if perms.sessao %}
<a href="{% url 'sapl.sessao:sessaoplenaria_create' %}" class="btn btn-default">
{% 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 %}
</a>
{% if filter_url %}
@ -50,4 +50,4 @@
{% endif %}
{% endblock detail_content %}
{% block table_content %}
{% endblock table_content %}
{% endblock table_content %}

Loading…
Cancel
Save