Browse Source

Fix Sessao Plenaria view for crispy form

pull/6/head
Edward Ribeiro 10 years ago
parent
commit
e714cbe113
  1. 14
      sessao/forms.py
  2. 6
      sessao/views.py
  3. 3
      templates/sessao/sessaoplenaria_form.html

14
sessao/forms.py

@ -38,17 +38,17 @@ class SessaoPlenariaForm(forms.ModelForm):
[_('Dados Básicos'), [_('Dados Básicos'),
[('numero', 3), [('numero', 3),
('tip_sessao_plen_FIXME', 3), ('tipo', 3),
('legislatura', 3), ('legislatura', 3),
('sessao_leg_FIXME', 3)], ('sessao_legislativa', 3)],
[('data_inicio', 12)], [('data_inicio', 12)],
[('data_fim', 12)], [('data_fim', 12)],
[('file_pauta_FIXME', 3), [('dia',2),
('file_ata_FIXME', 3), ('hora_inicio',2),
('url_audio', 3), ('hora_fim',2),
('url_video', 3)], ('tipo_expediente',6)],
[('url_audio', 6), ('url_video', 6)],
[('url_audio', 6), ('url_video', 6)]], [('url_audio', 6), ('url_video', 6)]],
) )

6
sessao/views.py

@ -3,7 +3,7 @@ from django.core.urlresolvers import reverse_lazy
from django.views.generic import CreateView, DeleteView, ListView, UpdateView, DetailView from django.views.generic import CreateView, DeleteView, ListView, UpdateView, DetailView
from sessao.models import SessaoPlenaria from sessao.models import SessaoPlenaria
from .forms import SessaoPlenariaForm
class SessaoPlenariaListView(ListView): class SessaoPlenariaListView(ListView):
model = SessaoPlenaria model = SessaoPlenaria
@ -15,8 +15,8 @@ class SessaoPlenariaDetailView(DetailView):
class SessaoPlenariaCreateView(CreateView): class SessaoPlenariaCreateView(CreateView):
model = SessaoPlenaria model = SessaoPlenaria
fields = [f.name for f in SessaoPlenaria._meta.fields] # fields = [f.name for f in SessaoPlenaria._meta.fields]
form_class = SessaoPlenariaForm
form_invalid_message = u"Something went wrong, post was not saved" form_invalid_message = u"Something went wrong, post was not saved"
success_url = reverse_lazy('sessao_list') success_url = reverse_lazy('sessao_list')

3
templates/sessao/sessaoplenaria_form.html

@ -1,11 +1,10 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n bootstrap3 crispy_forms_tags %} {% load i18n bootstrap3 crispy_forms_tags %}
{% block title %}SAPL{% endblock %} {% block title %}SAPL{% endblock %}
{% block content %} {% block content %}
<div id="content-main"> <div id="content-main">
{% crispy form %} {% crispy form %}
</div> </div>
{% endblock %} {% endblock %}
Loading…
Cancel
Save