Browse Source

Add helper in Expediente context

pull/6/head
Eduardo Edson Batista Cordeiro Alves 10 years ago
parent
commit
1a43152fe2
  1. 22
      sessao/views.py
  2. 7
      templates/sessao/expediente.html
  3. 2
      templates/sessao/presenca.html

22
sessao/views.py

@ -1,3 +1,5 @@
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Fieldset, Submit, ButtonHolder
from django.utils.translation import ugettext_lazy as _
from extra_views import InlineFormSetView
from sapl.crud import build_crud
@ -81,11 +83,29 @@ registro_votacao_crud = build_crud(
class ExpedienteView(InlineFormSetView):
model = SessaoPlenaria
inline_model = ExpedienteSessao
template_name = 'sessao/expediente.html'
fields = ('tipo', 'conteudo')
can_delete = False
extra = 1
# import ipdb; ipdb.set_trace()
def get_context_data(self, **kwargs):
context = super(ExpedienteView, self).get_context_data(**kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Fieldset(
'tipo',
'conteudo'
)
)
context.update({'helper': self.helper})
# import ipdb; ipdb.set_trace()
return context
class PresencaView(InlineFormSetView):

7
templates/sessao/expediente.html

@ -1,12 +1,15 @@
{% extends "sessao/sessaoplenaria_detail.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block detail_content %}
<form method="post">
{% csrf_token %}
{{ formset }}
{% csrf_token %}
{{formset}}
<br />
<input type="submit" value="Submit" />
</form>
{% endblock detail_content %}

2
templates/sessao/presenca.html

@ -13,7 +13,7 @@
<ul class="small-block-grid-1 medium-block-grid-1 large-block-grid-1">
<li><input type="checkbox" onClick="checkAll(this)" /> Marcar/Desmarcar Todos</li>
</ul>
{{formset}}
{% for fieldname in view.get_parlamentares %}
<ul class="small-block-grid-2 medium-block-grid-2 large-block-grid-2">
<li><input type="checkbox" name="presenca"/></li>

Loading…
Cancel
Save