diff --git a/comissoes/urls.py b/comissoes/urls.py new file mode 100644 index 000000000..3f0a90745 --- /dev/null +++ b/comissoes/urls.py @@ -0,0 +1,14 @@ +from django.conf.urls import url + +from comissoes.views import ( + comissao_crud, ComposicaoListView, MateriasListView, ReunioesListView) + + +urlpatterns = comissao_crud.urlpatterns + [ + url(r'^(?P\d+)/composicao$', ComposicaoListView.as_view(), name='composicao'), + url(r'^(?P\d+)/materias$', MateriasListView.as_view(), name='materias'), + url(r'^(?P\d+)/reunioes$', ReunioesListView.as_view(), name='reunioes'), + # url(r'^materias$', MateriasListView.as_view(), name='materias'), + # url(r'^reunioes$', ReunioesListView.as_view(), name='reunioes'), +] +comissoes_urls = urlpatterns, comissao_crud.namespace, comissao_crud.namespace diff --git a/comissoes/views.py b/comissoes/views.py index 8ae46b6f7..7bb9655ea 100644 --- a/comissoes/views.py +++ b/comissoes/views.py @@ -3,6 +3,7 @@ from django.utils.translation import ugettext_lazy as _ from .models import (TipoComissao, Comissao, Periodo, CargoComissao) from sapl.crud import build_crud + cargo_crud = build_crud( CargoComissao, @@ -52,3 +53,15 @@ comissao_crud = build_crud( ('data_prorrogada_temp', 4), ('data_fim_comissao', 4)]], ) + + +class ComposicaoListView(comissao_crud.CrudDetailView): + template_name = 'comissoes/composicao.html' + + +class MateriasListView(comissao_crud.CrudDetailView): + template_name = 'comissoes/materias.html' + + +class ReunioesListView(comissao_crud.CrudDetailView): + template_name = 'comissoes/reunioes.html' diff --git a/sapl/crud.py b/sapl/crud.py index d8338e13f..a90b69dd9 100644 --- a/sapl/crud.py +++ b/sapl/crud.py @@ -217,7 +217,7 @@ def build_crud(model, *layout): crud.CrudDeleteView = CrudDeleteView # XXX transform into a property of Crud to enable override - crud.urls = [ + crud.urlpatterns = [ url(r'^$', CrudListView.as_view(), name='list'), url(r'^create$', CrudCreateView.as_view(), name='create'), url(r'^(?P\d+)$', CrudDetailView.as_view(), name='detail'), @@ -225,6 +225,7 @@ def build_crud(model, *layout): CrudUpdateView.as_view(), name='update'), url(r'^(?P\d+)/delete$', CrudDeleteView.as_view(), name='delete'), - ], crud.namespace, crud.namespace + ] + crud.urls = crud.urlpatterns, crud.namespace, crud.namespace return crud diff --git a/sapl/urls.py b/sapl/urls.py index a9423dd45..24feedd5a 100644 --- a/sapl/urls.py +++ b/sapl/urls.py @@ -17,8 +17,8 @@ from django.conf.urls import include, url from django.contrib import admin from django.views.generic.base import TemplateView -from comissoes.views import (tipo_comissao_crud, comissao_crud, - periodo_composicao_crud, cargo_crud) +from comissoes.views import ( + tipo_comissao_crud, periodo_composicao_crud, cargo_crud) from parlamentares.views import (legislatura_crud, coligacao_crud, partido_crud, tipo_dependente_crud, nivel_instrucao_crud, tipo_afastamento_crud, @@ -33,16 +33,18 @@ from lexml.views import (lexml_provedor_crud, lexml_publicador_crud) from norma.views import (tipo_norma_crud, assunto_norma_crud) from sessao.views import (tipo_sessao_crud, tipo_resultado_votacao_crud, tipo_expediente_crud) +from comissoes.urls import comissoes_urls urlpatterns = [ url(r'^$', TemplateView.as_view(template_name='index.html')), url(r'^admin/', include(admin.site.urls)), # main apps - url(r'^comissoes/', include(comissao_crud.urls)), + url(r'^comissoes/', include(comissoes_urls)), url(r'^sessao/', include('sessao.urls')), - # system data + # SYSTEM DATA + # parlamentares url(r'^sistema/parlamentares/legislatura/', include(legislatura_crud.urls)), diff --git a/templates/comissoes/comissao_detail.html b/templates/comissoes/comissao_detail.html new file mode 100644 index 000000000..84e7213f6 --- /dev/null +++ b/templates/comissoes/comissao_detail.html @@ -0,0 +1,11 @@ +{% extends "crud/detail.html" %} +{% load i18n %} + +{% block sections_nav %} + +{% endblock sections_nav %} diff --git a/templates/comissoes/composicao.html b/templates/comissoes/composicao.html new file mode 100644 index 000000000..a544d611b --- /dev/null +++ b/templates/comissoes/composicao.html @@ -0,0 +1,6 @@ +{% extends "comissoes/comissao_detail.html" %} +{% load i18n %} + +{% block detail_content %} + TODO ... Composição +{% endblock detail_content %} diff --git a/templates/comissoes/materias.html b/templates/comissoes/materias.html new file mode 100644 index 000000000..d04b1fa1a --- /dev/null +++ b/templates/comissoes/materias.html @@ -0,0 +1,6 @@ +{% extends "comissoes/comissao_detail.html" %} +{% load i18n %} + +{% block detail_content %} + TODO ... Matérias +{% endblock detail_content %} diff --git a/templates/comissoes/reunioes.html b/templates/comissoes/reunioes.html new file mode 100644 index 000000000..22172c969 --- /dev/null +++ b/templates/comissoes/reunioes.html @@ -0,0 +1,6 @@ +{% extends "comissoes/comissao_detail.html" %} +{% load i18n %} + +{% block detail_content %} + TODO ... Reuniões +{% endblock detail_content %} diff --git a/templates/crud/detail.html b/templates/crud/detail.html index 5e54ee75b..4569057d2 100644 --- a/templates/crud/detail.html +++ b/templates/crud/detail.html @@ -1,36 +1,37 @@ {% extends "base.html" %} -{% load i18n crispy_forms_tags %} +{% load i18n %} {% block base_content %} {# FIXME is this the best markup to use? #} - +
+ + {% block sections_nav %}{% endblock %} +
- {# TODO replace fieldset for something semantically correct, but with similar visual grouping style #} - {% for fieldset in view.fieldsets %} -
- {{ fieldset.legend }} - {% for row in fieldset.rows %} -
- {% for column in row %} -
-
- {# TODO replace labels, probably (are they correct here?) #} -

{{ column.text }}

-
-
- {% endfor %} -
+ {% block detail_content %} + {# TODO replace fieldset for something semantically correct, but with similar visual grouping style #} + {% for fieldset in view.fieldsets %} +
+ {{ fieldset.legend }} + {% for row in fieldset.rows %} +
+ {% for column in row %} +
+
+ {# TODO replace labels, probably (are they correct here?) #} +

{{ column.text }}

+
+
+ {% endfor %} +
+ {% endfor %} +
{% endfor %} -
- {% endfor %} + {% endblock detail_content %} {% endblock %}