diff --git a/sapl/comissoes/views.py b/sapl/comissoes/views.py index 249b49899..d22eaff31 100644 --- a/sapl/comissoes/views.py +++ b/sapl/comissoes/views.py @@ -159,11 +159,6 @@ class ReuniaoCrud(MasterDetailCrud): def list_url(self): return '' - @property - def search_url(self): - namespace = self.model._meta.app_config.name - return reverse('%s:%s' % (namespace, 'pesquisar_reuniao')) - class ListView(MasterDetailCrud.ListView): template_name = "comissoes/reuniao_list.html" @@ -202,21 +197,12 @@ class ReuniaoCrud(MasterDetailCrud): form_class = ReuniaoForm - @property - def cancel_url(self): - return self.search_url - def get_initial(self): - comissao = Comissao.objects.order_by('-data').first() - if comissao: - return { - 'comissao': comissao - } - else: - msg = _('Cadastre alguma comissão antes de adicionar ' + - 'uma reunião!') - messages.add_message(self.request, messagesself.ERROR, msg) - return {} + def get_initial(self): + initial = super().get_initial() + initial['parent_pk'] = self.kwargs['pk'] + return initial + class DeleteView(MasterDetailCrud.DeleteView, RedirectView): diff --git a/sapl/templates/comissoes/layouts.yaml b/sapl/templates/comissoes/layouts.yaml index 916b2f339..4ca5041db 100644 --- a/sapl/templates/comissoes/layouts.yaml +++ b/sapl/templates/comissoes/layouts.yaml @@ -46,14 +46,9 @@ ParticipacaoEdit: Reuniao: {% trans 'Reunião' %}: - - periodo - - comissao - - tipo - - numero - - nome + - periodo comissao + - numero nome - tema - - data - - hora_inicio - - hora_fim - - local_reuniao + - data hora_inicio hora_fim + - local_reuniao:4 diff --git a/sapl/templates/comissoes/reuniao_list.html b/sapl/templates/comissoes/reuniao_list.html index 78629403a..cdecd459e 100644 --- a/sapl/templates/comissoes/reuniao_list.html +++ b/sapl/templates/comissoes/reuniao_list.html @@ -1,7 +1,21 @@ {% extends "crud/list.html" %} {% load i18n %} {% load crispy_forms_tags %} -{% block actions %}{% endblock %} -{% block detail_content %} - {% crispy form %} -{% endblock detail_content %} +{% block base_content %} + + {% if user.is_authenticated and perms.comissoes.add_composicao %} +
+ {% block actions %} +
+ {% if view.create_url %} + + {% blocktrans with verbose_name=view.verbose_name %} Adicionar {{ verbose_name }} {% endblocktrans %} + + {% endif %} + {% block more_buttons %}{% endblock more_buttons %} +
+ {% endblock actions %} +
+ {% endif %} + +{% endblock base_content %}