From 204583b3b18efd69d82bc88d0fe1a120f071113a Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Mon, 13 Jul 2015 12:14:12 -0300 Subject: [PATCH] Start comissoes app views and urls --- .../templates/comissoes/criar_comissao.html | 1 + .../templates/comissoes/lista_comissao.html | 23 +++++++++++++++++++ comissoes/urls.py | 10 ++++++++ comissoes/views.py | 21 +++++++++++++++-- sapl/urls.py | 5 ++++ 5 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 comissoes/templates/comissoes/criar_comissao.html create mode 100644 comissoes/templates/comissoes/lista_comissao.html create mode 100644 comissoes/urls.py diff --git a/comissoes/templates/comissoes/criar_comissao.html b/comissoes/templates/comissoes/criar_comissao.html new file mode 100644 index 000000000..59df07ed1 --- /dev/null +++ b/comissoes/templates/comissoes/criar_comissao.html @@ -0,0 +1 @@ +

Incluir comissão

\ No newline at end of file diff --git a/comissoes/templates/comissoes/lista_comissao.html b/comissoes/templates/comissoes/lista_comissao.html new file mode 100644 index 000000000..725be9661 --- /dev/null +++ b/comissoes/templates/comissoes/lista_comissao.html @@ -0,0 +1,23 @@ +{% load i18n %} +{% load tz %} + +

Comissões

+Incluir Comissão + + + + + + + + + + + {% for comissao in comissoes %} + + + + + {% endfor %} + +
{% trans 'Nome' %}{% trans 'Sigla' %}{% trans 'Tipo' %}
{{ comissao.nome }}{{ comissao.sigla }}{{ comissao.tipo }}
\ No newline at end of file diff --git a/comissoes/urls.py b/comissoes/urls.py new file mode 100644 index 000000000..59fc131dc --- /dev/null +++ b/comissoes/urls.py @@ -0,0 +1,10 @@ +from django.conf.urls import patterns, url + +from comissoes.views import (ListaComissoes, + CriarComissao) + +urlpatterns = patterns( + 'comissoes.views', + url(r'^$', ListaComissoes.as_view(), name='ListaComissoes'), + #url(r'^incluir$', CriarComissao.as_view(), name='CriarComissao'), +) \ No newline at end of file diff --git a/comissoes/views.py b/comissoes/views.py index 91ea44a21..45fcfb204 100644 --- a/comissoes/views.py +++ b/comissoes/views.py @@ -1,3 +1,20 @@ -from django.shortcuts import render +from vanilla import CreateView, DeleteView, ListView, UpdateView +from django.core.urlresolvers import reverse_lazy +from django.shortcuts import render, get_object_or_404 -# Create your views here. +from comissoes.models import Comissao + +class ListaComissoes(ListView): + model = Comissao + context_object_name = 'comissoes' + template_name = 'comissoes/lista_comissao.html' + +class CriarComissao(CreateView): + model = Comissao + success_url = reverse_lazy('ListaComissoes') + #template_name = 'comissoes/criar_comissao.html' + #fields = [''] + +class DetalheComissao(ListView): + model = Comissao + context_object_name = 'comissoes' \ No newline at end of file diff --git a/sapl/urls.py b/sapl/urls.py index 95fc1a4f2..b0042e128 100644 --- a/sapl/urls.py +++ b/sapl/urls.py @@ -16,6 +16,11 @@ Including another URLconf from django.conf.urls import include, url from django.contrib import admin +#from comissoes.views import (ListaComissoes, + #CriarComissao) +#from comissoes import views + urlpatterns = [ url(r'^admin/', include(admin.site.urls)), + url(r'^comissoes/', include('comissoes.urls')), ]