From c7a2923726fedc298b434f65b885db46e4821e62 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Tue, 20 Oct 2015 16:51:43 -0200 Subject: [PATCH] Fix QA issues --- materia/urls.py | 1 + materia/views.py | 69 +++++++++++++++++++++++-------------------- protocoloadm/urls.py | 20 ++++++++----- protocoloadm/views.py | 4 ++- 4 files changed, 53 insertions(+), 41 deletions(-) diff --git a/materia/urls.py b/materia/urls.py index c455d0f37..5964fdb80 100644 --- a/materia/urls.py +++ b/materia/urls.py @@ -1,4 +1,5 @@ from django.conf.urls import include, url + from materia.views import (FormularioCadastroView, FormularioSimplificadoView, autor_crud, materia_legislativa_crud, orgao_crud, origem_crud, regime_tramitacao_crud, diff --git a/materia/views.py b/materia/views.py index 8636c4526..f40db9377 100644 --- a/materia/views.py +++ b/materia/views.py @@ -1,16 +1,18 @@ -from datetime import date, datetime +from datetime import date from crispy_forms.helper import FormHelper from crispy_forms.layout import ButtonHolder, Fieldset, Layout, Submit from django import forms from django.core.urlresolvers import reverse -from django.shortcuts import render from django.forms import ModelForm +from django.shortcuts import render +from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from django.views.generic.edit import FormMixin -from sapl.crud import build_crud from vanilla import GenericView +from sapl.crud import build_crud + from .models import (Anexada, Autor, Autoria, DocumentoAcessorio, MateriaLegislativa, Numeracao, Orgao, Origem, Proposicao, RegimeTramitacao, Relatoria, StatusTramitacao, TipoAutor, @@ -295,6 +297,7 @@ class FormularioSimplificadoForm(forms.Form): # form.fields['otherFields'].widget.attrs['enabled'] = True + class FormularioCadastroForm(ModelForm): class Meta: @@ -410,35 +413,37 @@ class FormularioSimplificadoView(FormMixin, GenericView): return self.render_to_response({'form': form}) - # id serial NOT NULL, - # numero integer NOT NULL, - # ano smallint NOT NULL, - # numero_protocolo integer, - # data_apresentacao date, - # tipo_apresentacao character varying(1), - # data_publicacao date, - # numero_origem_externa character varying(5), - # ano_origem_externa smallint, - # data_origem_externa date, - # apelido character varying(50), - # dias_prazo integer, - # data_fim_prazo date, - # em_tramitacao boolean NOT NULL, - # polemica boolean, - # objeto character varying(150), - # complementar boolean, - # ementa text NOT NULL, - # indexacao text, - # observacao text, - # resultado text, - # local_origem_externa_id integer, - # regime_tramitacao_id integer NOT NULL, - # tipo_id integer NOT NULL, - # tipo_origem_externa_id integer, - # texto_original character varying(100), - - # duplicate key value violates unique constraint "materia_materialegislativa_tipo_id_2646a902479b4205_uniq" - # DETAIL: Key (tipo_id, numero, ano)=(2, 1, 2015) already exists. + # id serial NOT NULL, + # numero integer NOT NULL, + # ano smallint NOT NULL, + # numero_protocolo integer, + # data_apresentacao date, + # tipo_apresentacao character varying(1), + # data_publicacao date, + # numero_origem_externa character varying(5), + # ano_origem_externa smallint, + # data_origem_externa date, + # apelido character varying(50), + # dias_prazo integer, + # data_fim_prazo date, + # em_tramitacao boolean NOT NULL, + # polemica boolean, + # objeto character varying(150), + # complementar boolean, + # ementa text NOT NULL, + # indexacao text, + # observacao text, + # resultado text, + # local_origem_externa_id integer, + # regime_tramitacao_id integer NOT NULL, + # tipo_id integer NOT NULL, + # tipo_origem_externa_id integer, + # texto_original character varying(100), + + # duplicate key value violates unique constraint + # "materia_materialegislativa_tipo_id_2646a902479b4205_uniq" + # DETAIL: Key (tipo_id, numero, ano)=(2, 1, 2015) already exists. + class FormularioCadastroView(FormMixin, GenericView): template_name = "materia/formulario_cadastro.html" diff --git a/protocoloadm/urls.py b/protocoloadm/urls.py index d80211e0a..d45f2f7dd 100644 --- a/protocoloadm/urls.py +++ b/protocoloadm/urls.py @@ -1,10 +1,11 @@ from django.conf.urls import include, url -from protocoloadm.views import (AnularProtocoloAdmView, ProtocoloDocumentoView, - ProtocoloListView, ProtocoloMateriaView, - ProtocoloPesquisaView, - ProposicaoReceberView, ProposicoesIncorporadasView, - ProposicoesNaoIncorporadasView, ProposicoesNaoRecebidasView, +from protocoloadm.views import (AnularProtocoloAdmView, ProposicaoReceberView, + ProposicoesIncorporadasView, + ProposicoesNaoIncorporadasView, + ProposicoesNaoRecebidasView, + ProtocoloDocumentoView, ProtocoloListView, + ProtocoloMateriaView, ProtocoloPesquisaView, documento_acessorio_administrativo_crud, documento_administrativo_crud, protocolo_documento_crud, @@ -45,9 +46,12 @@ urlpatterns = [ url(r'^protocoloadm/proposicao-receber', ProposicaoReceberView.as_view(), name='proposicao_receber'), url(r'^protocoloadm/proposicoes-naorecebidas', - ProposicoesNaoRecebidasView.as_view(), name='proposicoes_naorecebidas'), + ProposicoesNaoRecebidasView.as_view(), + name='proposicoes_naorecebidas'), url(r'^protocoloadm/proposicoes-naoincorporadas', - ProposicoesNaoIncorporadasView.as_view(), name='proposicoes_naoincorporadas'), + ProposicoesNaoIncorporadasView.as_view(), + name='proposicoes_naoincorporadas'), url(r'^protocoloadm/proposicoes-incorporadas', - ProposicoesIncorporadasView.as_view(), name='proposicoes_incorporadas'), + ProposicoesIncorporadasView.as_view(), + name='proposicoes_incorporadas'), ] diff --git a/protocoloadm/views.py b/protocoloadm/views.py index 8b54c8def..b65db1934 100644 --- a/protocoloadm/views.py +++ b/protocoloadm/views.py @@ -12,7 +12,6 @@ from django.utils.translation import ugettext_lazy as _ from django.views.generic import ListView from django.views.generic.base import TemplateView from django.views.generic.edit import FormMixin - from vanilla import GenericView from materia.models import TipoMateriaLegislativa @@ -502,12 +501,15 @@ class ProtocoloMateriaView(FormMixin, GenericView): # TODO: move to Proposicao app + class ProposicaoReceberView(TemplateView): template_name = "protocoloadm/proposicao_receber.html" + class ProposicoesNaoRecebidasView(TemplateView): template_name = "protocoloadm/proposicoes_naorecebidas.html" + class ProposicoesNaoIncorporadasView(TemplateView): template_name = "protocoloadm/proposicoes_naoincorporadas.html"