Browse Source

Add new columns to search of Protocolo adm

pull/7/head
Edward Ribeiro 9 years ago
parent
commit
aa2e68f1d7
  1. 2
      painel/views.py
  2. 20
      protocoloadm/migrations/0005_auto_20151008_0744.py
  3. 1
      protocoloadm/urls.py
  4. 14
      protocoloadm/views.py
  5. 13
      templates/protocoloadm/protocolo_pesquisa.html

2
painel/views.py

@ -54,7 +54,7 @@ def cronometro_painel(request):
def painel_view(request, pk):
print(pk)
context = {'head_title': 'Painel Plenário', 'sessao_id': pk}
context = {'head_title': 'Painel Plenário', 'sessao_id': pk}
return render(request, 'painel/index.html', {'context': context})

20
protocoloadm/migrations/0005_auto_20151008_0744.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import protocoloadm.models
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0004_auto_20151007_1035'),
]
operations = [
migrations.AlterField(
model_name='documentoacessorioadministrativo',
name='arquivo',
field=models.FileField(blank=True, null=True, upload_to=protocoloadm.models.texto_upload_path, verbose_name='Arquivo'),
),
]

1
protocoloadm/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url
from protocoloadm.views import (ProtocoloPesquisaView, anular_protocolo_crud,
documento_acessorio_administrativo_crud,
documento_administrativo_crud,

14
protocoloadm/views.py

@ -1,8 +1,11 @@
from datetime import datetime
from django import forms
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView
from django.views.generic.edit import FormMixin
from materia.models import TipoMateriaLegislativa
from sapl.crud import build_crud
@ -117,7 +120,7 @@ class ProtocoloPesquisaView(ListView, FormMixin):
def get_context_data(self, **kwargs):
context = super(ProtocoloPesquisaView, self).get_context_data(**kwargs)
context.update(self.extra_context)
return context
return context
def get_queryset(self):
return Protocolo.objects.all()
@ -133,6 +136,8 @@ class ProtocoloPesquisaView(ListView, FormMixin):
if form.is_valid():
kwargs = {}
# format = '%Y-%m-%d'
if request.POST['tipo_protocolo']:
kwargs['tipo_protocolo'] = request.POST['tipo_protocolo']
@ -143,10 +148,11 @@ class ProtocoloPesquisaView(ListView, FormMixin):
kwargs['ano'] = request.POST['ano']
if request.POST['inicial']:
kwargs['inicial'] = request.POST['inicial']
kwargs['data'] = datetime.strptime(
request.POST['inicial'], '%d/%m/%Y').strftime('%Y-%m-%d')
if request.POST['final']:
kwargs['final'] = request.POST['final']
# if request.POST['final']:
# kwargs['final'] = request.POST['final']
if request.POST['tipo_documento']:
kwargs['tipo_documento'] = request.POST['tipo_documento']

13
templates/protocoloadm/protocolo_pesquisa.html

@ -70,8 +70,19 @@
{% if protocolos %}
<table>
<tr><td>Número de Protocolo</td>
<td>Assunto</td>
<td>Tipo de Documento</td>
<td>Ano</td>
<td>Data</td>
</tr>
{% for p in protocolos %}
<tr><td>{{ p.numero }}</td><td>{{ p.assunto_ementa }}</td></tr>
<tr><td>{{ p.numero }}</td>
<td>{{ p.assunto_ementa }}</td>
<td>{{ p.tipo_documento }}</td>
<td>{{ p.ano }}</td>
<td>{{ p.data|date:"d/m/Y" }}</td>
</tr>
{% endfor %}
</table>
Total: {{ protocolos|length }}

Loading…
Cancel
Save