From e0caa64871ac5a9f67ae987dbac75decfac6dcb8 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Thu, 19 May 2016 11:30:23 -0300 Subject: [PATCH] Fix #416 modulo administrativo (#466) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adicona link para tipo documento administrativo e status tramitacao administrativo * Muda campos apresentados na listagem da tramitacao * Cria tipo de instituição * Fix qa * Ordena listagem pela sigla * Adiciona indicador na listagem --- parlamentares/migrations/0021_merge.py | 16 ++++++++++++ parlamentares/views.py | 1 + protocoloadm/layouts.yaml | 4 +++ .../migrations/0012_tipoinstituicao.py | 26 +++++++++++++++++++ protocoloadm/models.py | 11 ++++++++ protocoloadm/urls.py | 5 +++- protocoloadm/views.py | 22 +++++++++++----- templates/sistema.html | 6 ++--- 8 files changed, 81 insertions(+), 10 deletions(-) create mode 100644 parlamentares/migrations/0021_merge.py create mode 100644 protocoloadm/migrations/0012_tipoinstituicao.py diff --git a/parlamentares/migrations/0021_merge.py b/parlamentares/migrations/0021_merge.py new file mode 100644 index 000000000..e29731513 --- /dev/null +++ b/parlamentares/migrations/0021_merge.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-05-19 14:18 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('parlamentares', '0019_auto_20160518_1204'), + ('parlamentares', '0020_auto_20160518_1201'), + ] + + operations = [ + ] diff --git a/parlamentares/views.py b/parlamentares/views.py index 371103328..de5e80750 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -18,6 +18,7 @@ from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa, NivelInstrucao, Parlamentar, Partido, SessaoLegislativa, SituacaoMilitar, TipoAfastamento, TipoDependente) + CargoMesaCrud = Crud.build(CargoMesa, 'cargo_mesa') PartidoCrud = Crud.build(Partido, 'partidos') SessaoLegislativaCrud = Crud.build(SessaoLegislativa, 'sessao_legislativa') diff --git a/protocoloadm/layouts.yaml b/protocoloadm/layouts.yaml index 32ba858ee..304cd0bd8 100644 --- a/protocoloadm/layouts.yaml +++ b/protocoloadm/layouts.yaml @@ -46,3 +46,7 @@ Protocolo: - assunto_ementa - autor - observacao + +TipoInstituicao: + Tipo de Instituição: + - descricao diff --git a/protocoloadm/migrations/0012_tipoinstituicao.py b/protocoloadm/migrations/0012_tipoinstituicao.py new file mode 100644 index 000000000..91884018a --- /dev/null +++ b/protocoloadm/migrations/0012_tipoinstituicao.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-05-17 18:07 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('protocoloadm', '0011_auto_20160318_1504'), + ] + + operations = [ + migrations.CreateModel( + name='TipoInstituicao', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), + ], + options={ + 'verbose_name': 'Tipo de Instituição', + 'verbose_name_plural': 'Tipos de Instituições', + }, + ), + ] diff --git a/protocoloadm/models.py b/protocoloadm/models.py index 9d2f922cd..b85b44d0d 100644 --- a/protocoloadm/models.py +++ b/protocoloadm/models.py @@ -8,6 +8,17 @@ from materia.models import Autor, TipoMateriaLegislativa, UnidadeTramitacao from sapl.utils import RANGE_ANOS, YES_NO_CHOICES +class TipoInstituicao(models.Model): + descricao = models.CharField(max_length=50, verbose_name=_('Descrição')) + + class Meta: + verbose_name = _('Tipo de Instituição') + verbose_name_plural = _('Tipos de Instituições') + + def __str__(self): + return self.descricao + + class TipoDocumentoAdministrativo(models.Model): sigla = models.CharField(max_length=5, verbose_name=_('Sigla')) descricao = models.CharField(max_length=50, verbose_name=_('Descrição')) diff --git a/protocoloadm/urls.py b/protocoloadm/urls.py index 09951476d..ea6cad974 100644 --- a/protocoloadm/urls.py +++ b/protocoloadm/urls.py @@ -19,7 +19,8 @@ from protocoloadm.views import (AnularProtocoloAdmView, ProtocoloPesquisaView, StatusTramitacaoAdministrativoCrud, TipoDocumentoAdministrativoCrud, - TramitacaoAdmDeleteView, TramitacaoAdmEditView, + TipoInstituicaoCrud, TramitacaoAdmDeleteView, + TramitacaoAdmEditView, TramitacaoAdmIncluirView, TramitacaoAdministrativoCrud, TramitacaoAdmView, get_nome_autor, @@ -38,6 +39,8 @@ urlpatterns = [ include(DocumentoAcessorioAdministrativoCrud.get_urls())), url(r'^protocoloadm/status-tramitacao-adm/', include(StatusTramitacaoAdministrativoCrud.get_urls())), + url(r'^protocoloadm/tipo-instituicao/', + include(TipoInstituicaoCrud.get_urls())), url(r'^protocoloadm/tramitacao-adm/', include(TramitacaoAdministrativoCrud.get_urls())), url(r'^protocoloadm/protocolo-doc/', diff --git a/protocoloadm/views.py b/protocoloadm/views.py index 19e67e9ba..36e4431cf 100644 --- a/protocoloadm/views.py +++ b/protocoloadm/views.py @@ -12,6 +12,7 @@ from django.views.generic import CreateView, DetailView, FormView, ListView from django.views.generic.base import TemplateView from django_filters.views import FilterView +import crud.base from crud.base import Crud, make_pagination from materia.models import Proposicao, TipoMateriaLegislativa from sapl.utils import create_barcode, get_client_ip @@ -24,20 +25,29 @@ from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm, from .models import (Autor, DocumentoAcessorioAdministrativo, DocumentoAdministrativo, Protocolo, StatusTramitacaoAdministrativo, - TipoDocumentoAdministrativo, TramitacaoAdministrativo) + TipoDocumentoAdministrativo, TipoInstituicao, + TramitacaoAdministrativo) -TipoDocumentoAdministrativoCrud = Crud.build(TipoDocumentoAdministrativo, - '') +TipoDocumentoAdministrativoCrud = Crud.build(TipoDocumentoAdministrativo, '') DocumentoAdministrativoCrud = Crud.build(DocumentoAdministrativo, '') DocumentoAcessorioAdministrativoCrud = Crud.build( DocumentoAcessorioAdministrativo, '') -StatusTramitacaoAdministrativoCrud = Crud.build( - StatusTramitacaoAdministrativo, '') TramitacaoAdministrativoCrud = Crud.build(TramitacaoAdministrativo, '') ProtocoloDocumentoCrud = Crud.build(Protocolo, '') - # FIXME precisa de uma chave diferente para o layout ProtocoloMateriaCrud = Crud.build(Protocolo, '') +TipoInstituicaoCrud = Crud.build(TipoInstituicao, '') + + +class StatusTramitacaoAdministrativoCrud(Crud): + model = StatusTramitacaoAdministrativo + help_path = '' + + class BaseMixin(crud.base.CrudBaseMixin): + list_field_names = ['sigla', 'indicador', 'descricao'] + + class ListView(crud.base.CrudListView): + ordering = 'sigla' class ProtocoloPesquisaView(FilterView): diff --git a/templates/sistema.html b/templates/sistema.html index 7ae09972d..a859ff5e9 100644 --- a/templates/sistema.html +++ b/templates/sistema.html @@ -81,9 +81,9 @@

Módulo Administrativo

- - - + + +
{% endblock base_content %}