Browse Source

Fix urls and views of sessao

pull/6/head
Edward Ribeiro 10 years ago
parent
commit
4ab4dee94f
  1. 9
      sessao/urls.py
  2. 11
      sessao/views.py
  3. 30
      templates/comissoes/sessao_list.html
  4. 3
      templates/sessao/sessaoplenaria_form.html
  5. 4
      templates/sessao/sessaoplenaria_list.html

9
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<pk>\d+)$', SessaoDetailView.as_view(), name='sessao_detail'),
url(r'^(?P<pk>\d+)/edit$', SessaoUpdateView.as_view(), name='sessao_update'),
url(r'^$', SessaoPlenariaListView.as_view(), name='sessaoplenaria_list'),
url(r'^(?P<pk>\d+)$', SessaoPlenariaDetailView.as_view(), name='sessaoplenaria_detail'),
url(r'^add$', SessaoPlenariaCreateView.as_view(), name='sessaoplenaria_update'),
url(r'^(?P<pk>\d+)/edit$', SessaoPlenariaUpdateView.as_view(), name='sessaoplenaria_update'),
)

11
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')

30
templates/comissoes/sessao_list.html

@ -1,30 +0,0 @@
{% extends "base.html" %}
{% load i18n bootstrap3 %}
{% block title %}SAPL{% endblock %}
{% block content %}
<div id="content-main">
<p>Sessão Legislativa</p>
<a href="/admin/sessao/sessao/add/">Incluir Sessão</a>
<table class="table table-hover">
<thead>
<tr>
<th>{% trans 'Sessão Legislativa' %}</th>
<th>{% trans 'Legislatura' %}</th>
<th>{% trans 'Tipo' %}</th>
</tr>
</thead>
<tbody>
{% for sessao in object_list %}
<td>{{ sessao.sessao_legislativa }}</td>
<td>{{ sessao.legislatura }}</td>
<td>{{ sessao.tipo }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

3
templates/sessao/sessaoplenaria_form.html

@ -5,6 +5,9 @@
{% block content %}
<div id="content-main">
<p>Sessão Legislativa</p>
{# Display a form #}
<form method="post" class="form">
{% csrf_token %}

4
templates/sessao/sessaoplenaria_list.html

@ -5,8 +5,8 @@
{% block content %}
<div id="content-main">
<p>Comissões</p>
<a href="/admin/comissoes/comissao/add/">Incluir Sessão</a>
<p>Sessão Legislativa</p>
<a href="add">Incluir Sessão</a>
<table class="table table-hover">
<thead>

Loading…
Cancel
Save