Browse Source

Add new columns to search of Protocolo adm

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

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,

12
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
@ -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