From 4ab4dee94f94d2866a3f06b29512ea32e36f0819 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Thu, 16 Jul 2015 15:54:32 -0300 Subject: [PATCH] Fix urls and views of sessao --- sessao/urls.py | 9 ++++--- sessao/views.py | 11 +++++---- templates/comissoes/sessao_list.html | 30 ----------------------- templates/sessao/sessaoplenaria_form.html | 3 +++ templates/sessao/sessaoplenaria_list.html | 4 +-- 5 files changed, 16 insertions(+), 41 deletions(-) delete mode 100644 templates/comissoes/sessao_list.html diff --git a/sessao/urls.py b/sessao/urls.py index ec161088d..e4e33ad2a 100644 --- a/sessao/urls.py +++ b/sessao/urls.py @@ -1,11 +1,12 @@ from django.conf.urls import patterns, url -from sessao.views import SessaoListView, SessaoDetailView, SessaoUpdateView +from sessao.views import SessaoPlenariaListView, SessaoPlenariaDetailView, SessaoPlenariaCreateView, SessaoPlenariaUpdateView urlpatterns = patterns( 'comissoes.views', - url(r'^$', SessaoListView.as_view(), name='sessao_list'), - url(r'^(?P\d+)$', SessaoDetailView.as_view(), name='sessao_detail'), - url(r'^(?P\d+)/edit$', SessaoUpdateView.as_view(), name='sessao_update'), + url(r'^$', SessaoPlenariaListView.as_view(), name='sessaoplenaria_list'), + url(r'^(?P\d+)$', SessaoPlenariaDetailView.as_view(), name='sessaoplenaria_detail'), + url(r'^add$', SessaoPlenariaCreateView.as_view(), name='sessaoplenaria_update'), + url(r'^(?P\d+)/edit$', SessaoPlenariaUpdateView.as_view(), name='sessaoplenaria_update'), ) diff --git a/sessao/views.py b/sessao/views.py index ef95f8298..219659885 100644 --- a/sessao/views.py +++ b/sessao/views.py @@ -5,20 +5,21 @@ from django.views.generic import CreateView, DeleteView, ListView, UpdateView, D from sessao.models import SessaoPlenaria -class SessaoListView(ListView): +class SessaoPlenariaListView(ListView): model = SessaoPlenaria -class SessaoDetailView(DetailView): +class SessaoPlenariaDetailView(DetailView): model = SessaoPlenaria -class SessaoCreateView(CreateView): +class SessaoPlenariaCreateView(CreateView): model = SessaoPlenaria + fields = [f.name for f in SessaoPlenaria._meta.fields] success_url = reverse_lazy('sessao_list') -class SessaoUpdateView(FormMessagesMixin, UpdateView): +class SessaoPlenariaUpdateView(FormMessagesMixin, UpdateView): model = SessaoPlenaria fields = [f.name for f in SessaoPlenaria._meta.fields] @@ -30,6 +31,6 @@ class SessaoUpdateView(FormMessagesMixin, UpdateView): return u"{0} updated successfully!".format(self.object) -class SessaoDeleteView(DeleteView): +class SessaoPlenariaDeleteView(DeleteView): model = SessaoPlenaria success_url = reverse_lazy('sessao_list') diff --git a/templates/comissoes/sessao_list.html b/templates/comissoes/sessao_list.html deleted file mode 100644 index a4e5e0f7b..000000000 --- a/templates/comissoes/sessao_list.html +++ /dev/null @@ -1,30 +0,0 @@ -{% extends "base.html" %} -{% load i18n bootstrap3 %} - -{% block title %}SAPL{% endblock %} - -{% block content %} -
-

Sessão Legislativa

- Incluir Sessão - - - - - - - - - - - {% for sessao in object_list %} - - - - - {% endfor %} - -
{% trans 'Sessão Legislativa' %}{% trans 'Legislatura' %}{% trans 'Tipo' %}
{{ sessao.sessao_legislativa }}{{ sessao.legislatura }}{{ sessao.tipo }}
-
-{% endblock %} - diff --git a/templates/sessao/sessaoplenaria_form.html b/templates/sessao/sessaoplenaria_form.html index f0e38178c..d979fcbc2 100644 --- a/templates/sessao/sessaoplenaria_form.html +++ b/templates/sessao/sessaoplenaria_form.html @@ -5,6 +5,9 @@ {% block content %}
+ +

Sessão Legislativa

+ {# Display a form #}
{% csrf_token %} diff --git a/templates/sessao/sessaoplenaria_list.html b/templates/sessao/sessaoplenaria_list.html index 368976d78..ae80b5802 100644 --- a/templates/sessao/sessaoplenaria_list.html +++ b/templates/sessao/sessaoplenaria_list.html @@ -5,8 +5,8 @@ {% block content %}
-

Comissões

- Incluir Sessão +

Sessão Legislativa

+ Incluir Sessão