diff --git a/sapl/urls.py b/sapl/urls.py index 6b5a56e55..bc974e661 100644 --- a/sapl/urls.py +++ b/sapl/urls.py @@ -22,4 +22,5 @@ urlpatterns = [ url(r'^$', TemplateView.as_view(template_name='index.html')), url(r'^admin/', include(admin.site.urls)), url(r'^comissoes/', include('comissoes.urls')), + url(r'^sessao/', include('sessao.urls')), ] diff --git a/sessao/urls.py b/sessao/urls.py new file mode 100644 index 000000000..ec161088d --- /dev/null +++ b/sessao/urls.py @@ -0,0 +1,11 @@ +from django.conf.urls import patterns, url + +from sessao.views import SessaoListView, SessaoDetailView, SessaoUpdateView + + +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'), +) diff --git a/sessao/views.py b/sessao/views.py index 91ea44a21..ef95f8298 100644 --- a/sessao/views.py +++ b/sessao/views.py @@ -1,3 +1,35 @@ -from django.shortcuts import render +from braces.views import FormMessagesMixin +from django.core.urlresolvers import reverse_lazy +from django.views.generic import CreateView, DeleteView, ListView, UpdateView, DetailView -# Create your views here. +from sessao.models import SessaoPlenaria + + +class SessaoListView(ListView): + model = SessaoPlenaria + + +class SessaoDetailView(DetailView): + model = SessaoPlenaria + + +class SessaoCreateView(CreateView): + model = SessaoPlenaria + success_url = reverse_lazy('sessao_list') + + +class SessaoUpdateView(FormMessagesMixin, UpdateView): + model = SessaoPlenaria + fields = [f.name for f in SessaoPlenaria._meta.fields] + + success_url = reverse_lazy('sessao_list') + + form_invalid_message = u"Something went wrong, post was not saved" + + def get_form_valid_message(self): + return u"{0} updated successfully!".format(self.object) + + +class SessaoDeleteView(DeleteView): + model = SessaoPlenaria + success_url = reverse_lazy('sessao_list') diff --git a/templates/comissoes/sessao_list.html b/templates/comissoes/sessao_list.html new file mode 100644 index 000000000..a4e5e0f7b --- /dev/null +++ b/templates/comissoes/sessao_list.html @@ -0,0 +1,30 @@ +{% 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 new file mode 100644 index 000000000..f0e38178c --- /dev/null +++ b/templates/sessao/sessaoplenaria_form.html @@ -0,0 +1,22 @@ +{% extends "base.html" %} +{% load i18n bootstrap3 %} + +{% block title %}SAPL{% endblock %} + +{% block content %} +
+ {# Display a form #} +
+ {% csrf_token %} + + {% bootstrap_form form %} + + {% buttons %} + + {% endbuttons %} +
+
+{% endblock %} + diff --git a/templates/sessao/sessaoplenaria_list.html b/templates/sessao/sessaoplenaria_list.html new file mode 100644 index 000000000..368976d78 --- /dev/null +++ b/templates/sessao/sessaoplenaria_list.html @@ -0,0 +1,30 @@ +{% extends "base.html" %} +{% load i18n bootstrap3 %} + +{% block title %}SAPL{% endblock %} + +{% block content %} +
+

Comissões

+ 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 %} +