Browse Source

Start comissoes app views and urls

pull/6/head
Eduardo Edson Batista Cordeiro Alves 10 years ago
committed by Marcio Mazza
parent
commit
204583b3b1
  1. 1
      comissoes/templates/comissoes/criar_comissao.html
  2. 23
      comissoes/templates/comissoes/lista_comissao.html
  3. 10
      comissoes/urls.py
  4. 21
      comissoes/views.py
  5. 5
      sapl/urls.py

1
comissoes/templates/comissoes/criar_comissao.html

@ -0,0 +1 @@
<p>Incluir comissão</p>

23
comissoes/templates/comissoes/lista_comissao.html

@ -0,0 +1,23 @@
{% load i18n %}
{% load tz %}
<p>Comissões</p>
<a href="/admin/comissoes/comissao/add/">Incluir Comissão</a>
<table class="table table-hover">
<thead>
<tr>
<th>{% trans 'Nome' %}</th>
<th>{% trans 'Sigla' %}</th>
<th>{% trans 'Tipo' %}</th>
</tr>
</thead>
<tbody>
{% for comissao in comissoes %}
<td>{{ comissao.nome }}</td>
<td>{{ comissao.sigla }}</td>
<td>{{ comissao.tipo }}</td>
</tr>
{% endfor %}
</tbody>
</table>

10
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'),
)

21
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'

5
sapl/urls.py

@ -16,6 +16,11 @@ Including another URLconf
from django.conf.urls import include, url from django.conf.urls import include, url
from django.contrib import admin from django.contrib import admin
#from comissoes.views import (ListaComissoes,
#CriarComissao)
#from comissoes import views
urlpatterns = [ urlpatterns = [
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url(r'^comissoes/', include('comissoes.urls')),
] ]

Loading…
Cancel
Save