Browse Source

Adiciona template de cadastro de reunião

pull/1614/head
Mariana Mendes 8 years ago
parent
commit
0ec5aaf746
  1. 24
      sapl/comissoes/views.py
  2. 13
      sapl/templates/comissoes/layouts.yaml
  3. 22
      sapl/templates/comissoes/reuniao_list.html

24
sapl/comissoes/views.py

@ -159,11 +159,6 @@ class ReuniaoCrud(MasterDetailCrud):
def list_url(self): def list_url(self):
return '' return ''
@property
def search_url(self):
namespace = self.model._meta.app_config.name
return reverse('%s:%s' % (namespace, 'pesquisar_reuniao'))
class ListView(MasterDetailCrud.ListView): class ListView(MasterDetailCrud.ListView):
template_name = "comissoes/reuniao_list.html" template_name = "comissoes/reuniao_list.html"
@ -202,21 +197,12 @@ class ReuniaoCrud(MasterDetailCrud):
form_class = ReuniaoForm form_class = ReuniaoForm
@property
def cancel_url(self):
return self.search_url
def get_initial(self): def get_initial(self):
comissao = Comissao.objects.order_by('-data').first() def get_initial(self):
if comissao: initial = super().get_initial()
return { initial['parent_pk'] = self.kwargs['pk']
'comissao': comissao return initial
}
else:
msg = _('Cadastre alguma comissão antes de adicionar ' +
'uma reunião!')
messages.add_message(self.request, messagesself.ERROR, msg)
return {}
class DeleteView(MasterDetailCrud.DeleteView, RedirectView): class DeleteView(MasterDetailCrud.DeleteView, RedirectView):

13
sapl/templates/comissoes/layouts.yaml

@ -46,14 +46,9 @@ ParticipacaoEdit:
Reuniao: Reuniao:
{% trans 'Reunião' %}: {% trans 'Reunião' %}:
- periodo - periodo comissao
- comissao - numero nome
- tipo
- numero
- nome
- tema - tema
- data - data hora_inicio hora_fim
- hora_inicio - local_reuniao:4
- hora_fim
- local_reuniao

22
sapl/templates/comissoes/reuniao_list.html

@ -1,7 +1,21 @@
{% extends "crud/list.html" %} {% extends "crud/list.html" %}
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block actions %}{% endblock %} {% block base_content %}
{% block detail_content %}
{% crispy form %} {% if user.is_authenticated and perms.comissoes.add_composicao %}
{% endblock detail_content %} <div class="context-actions clearfix">
{% block actions %}
<div class="actions btn-group pull-right btn-group-lg" role="group">
{% if view.create_url %}
<a href="{{ view.create_url }}" class="btn btn-default">
{% blocktrans with verbose_name=view.verbose_name %} Adicionar {{ verbose_name }} {% endblocktrans %}
</a>
{% endif %}
{% block more_buttons %}{% endblock more_buttons %}
</div>
{% endblock actions %}
</div>
{% endif %}
{% endblock base_content %}

Loading…
Cancel
Save