Browse Source

Fix QA Tests

pull/11/merge
Edward Ribeiro 9 years ago
parent
commit
1fa81a3a2d
  1. BIN
      barcode.gif
  2. 57
      barcode.pdf
  3. 10
      barcode.py
  4. 10
      comissoes/urls.py
  5. 4
      comissoes/views.py
  6. 1
      materia/urls.py
  7. 61
      materia/views.py
  8. 7
      painel/urls.py
  9. 7
      painel/views.py
  10. 1
      parlamentares/urls.py
  11. 15
      parlamentares/views.py
  12. 5
      protocoloadm/urls.py
  13. 6
      protocoloadm/views.py

BIN
barcode.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

57
barcode.pdf

@ -0,0 +1,57 @@
%PDF-1.4
%“Œ‹ž ReportLab Generated PDF document http://www.reportlab.com
1 0 obj
<< /F1 2 0 R /F2 3 0 R /F3 4 0 R >>
endobj
2 0 obj
<< /BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font >>
endobj
3 0 obj
<< /BaseFont /Times-Roman /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font >>
endobj
4 0 obj
<< /BaseFont /Courier /Encoding /WinAnsiEncoding /Name /F3 /Subtype /Type1 /Type /Font >>
endobj
5 0 obj
<< /Contents 9 0 R /MediaBox [ 0 0 120.24 38.82282 ] /Parent 8 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
/Type /Page >>
endobj
6 0 obj
<< /Outlines 10 0 R /PageMode /UseNone /Pages 8 0 R /Type /Catalog >>
endobj
7 0 obj
<< /Author (anonymous) /CreationDate (D:20151119124244+03'00') /Creator (ReportLab PDF Library - www.reportlab.com) /Keywords () /Producer (ReportLab PDF Library - www.reportlab.com) /Subject (unspecified)
/Title () >>
endobj
8 0 obj
<< /Count 1 /Kids [ 5 0 R ] /Type /Pages >>
endobj
9 0 obj
<< /Filter [ /ASCII85Decode /FlateDecode ] /Length 541 >>
stream
Gatn&btGr>&B4*hr"!kuK&b/EAj<G-<?tCE!Zo:D>+s;p^%h%Xfb-rX(A*lXP)l0#H*>!=YX1fD;LY7i6rtC7h?\t7DFrj@;qKI)X/l!+13?l)O&%h-V*A,5Q&Ma/W`318;l]4]CW_1Hm;TF\qfSja7sW[Zo&u5Rp+a)HrQa$QdVJ)eBUFc67=DK]D%0]F2R2ki#MQo?VQT%d`VY,Y^5IZ??@trj.4cirOiSND?K&p(?c5S*!Yo^F4m^2n%X9Ld,9BJ>PY_s)g#/P`a!&7#1n<K#>i^i2lP/%sU?MS\`!]'p'X,kefT0tI-=B25/aQ!$`M7:7>!/(imA;Y;d]a1j8n<DQ8"#hLV]-=TG_le80'jr6\+#Ol,)6hbU>Y%86t).o&j6W8ZG^AL:;p\!at;D*;N$<nKE_CFPLDkJ;"CNObUKj5n>FJG:F.O"3;hGa9PmgFnRut`hPs*r@SGY_kX^[!B(JkmUCDqS@HV[t`isO2c%%FE(Ptl>=*/4=]:67rN#lShpA1;j'm5^<1`q4HY!)kArHp*~>endstream
endobj
10 0 obj
<< /Count 0 /Type /Outlines >>
endobj
xref
0 11
0000000000 65535 f
0000000075 00000 n
0000000129 00000 n
0000000239 00000 n
0000000351 00000 n
0000000459 00000 n
0000000664 00000 n
0000000752 00000 n
0000000993 00000 n
0000001055 00000 n
0000001691 00000 n
trailer
<< /ID
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
[(\014\3360\267W\316\\\362\367\200\213i0\214le) (\014\3360\267W\316\\\362\367\200\213i0\214le)]
/Info 7 0 R /Root 6 0 R /Size 11 >>
startxref
1741
%%EOF

10
barcode.py

@ -1,14 +1,16 @@
from reportlab.lib.units import mm
from reportlab.graphics.barcode import createBarcodeDrawing
from reportlab.graphics.shapes import Drawing, String
from reportlab.graphics.charts.barcharts import HorizontalBarChart
from reportlab.graphics.shapes import Drawing
from reportlab.lib.units import mm
class BarcodeDrawing(Drawing):
def __init__(self, text_value, *args, **kw):
barcode = createBarcodeDrawing(
'Code128', value=text_value, barHeight=10 * mm, humanReadable=True)
'Code128',
value=text_value,
barHeight=10 * mm,
humanReadable=True)
Drawing.__init__(self, barcode.width, barcode.height, *args, **kw)
self.add(barcode, name='barcode')

10
comissoes/urls.py

@ -1,7 +1,7 @@
from django.conf.urls import include, url
from comissoes.views import (ComissaoParlamentarIncluirView, ComposicaoView,
ComissaoParlamentarEditView,
from comissoes.views import (ComissaoParlamentarEditView,
ComissaoParlamentarIncluirView, ComposicaoView,
MateriasView, ReunioesView, cargo_crud,
comissao_crud, periodo_composicao_crud,
tipo_comissao_crud)
@ -10,9 +10,11 @@ comissao_url_patterns = comissao_crud.urlpatterns + [
url(r'^(?P<pk>\d+)/composicao$',
ComposicaoView.as_view(), name='composicao'),
url(r'^(?P<pk>\d+)/composicao/(?P<id>\d+)/parlamentar$',
ComissaoParlamentarIncluirView.as_view(), name='comissao_parlamentar'),
ComissaoParlamentarIncluirView.as_view(),
name='comissao_parlamentar'),
url(r'^(?P<pk>\d+)/composicao/parlamentar/(?P<id>\d+)/edit$',
ComissaoParlamentarEditView.as_view(), name='comissao_parlamentar_edit'),
ComissaoParlamentarEditView.as_view(),
name='comissao_parlamentar_edit'),
url(r'^(?P<pk>\d+)/materias$',
MateriasView.as_view(), name='materias'),
url(r'^(?P<pk>\d+)/reunioes$',

4
comissoes/views.py

@ -240,8 +240,8 @@ class ComissaoParlamentarEditView(FormMixin, GenericView):
participacao = Participacao.objects.get(id=participacao_id)
comissao = Comissao.objects.get(id=self.kwargs['pk'])
form = ParticipacaoCadastroForm(
initial={'parlamentar_id': participacao.parlamentar.id}, instance=participacao)
print(form)
initial={'parlamentar_id': participacao.parlamentar.id},
instance=participacao)
return self.render_to_response({'form': form,
'comissao': comissao,
'composicao_id': self.kwargs['id']})

1
materia/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url
from materia.views import (AutoriaEditView, AutoriaView,
DespachoInicialEditView, DespachoInicialView,
DocumentoAcessorioEditView, DocumentoAcessorioView,

61
materia/views.py

@ -1,8 +1,6 @@
from datetime import date, datetime
from datetime import date
from re import sub
import sapl
from comissoes.models import Comissao, Composicao
from crispy_forms.helper import FormHelper
from crispy_forms.layout import (HTML, ButtonHolder, Column, Fieldset, Layout,
Submit)
@ -14,11 +12,13 @@ from django.utils.html import strip_tags
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView
from django.views.generic.detail import SingleObjectMixin
from django.views.generic.edit import FormMixin
from vanilla import GenericView
import sapl
from comissoes.models import Comissao, Composicao
from norma.models import LegislacaoCitada, NormaJuridica, TipoNormaJuridica
from sapl.crud import build_crud
from vanilla import GenericView
from .models import (Anexada, Autor, Autoria, DespachoInicial,
DocumentoAcessorio, MateriaLegislativa, Numeracao, Orgao,
@ -284,7 +284,8 @@ class FormularioSimplificadoForm(ModelForm):
Fieldset(
'Identificação Básica',
HTML(
"<ul class='small-block-grid-3 medium-block-grid-3 large-block-grid-3'>"),
"<ul class='small-block-grid-3 " +
"medium-block-grid-3 large-block-grid-3'>"),
HTML("<li>"),
'tipo',
HTML("</li>"),
@ -296,7 +297,8 @@ class FormularioSimplificadoForm(ModelForm):
HTML("</li>"),
HTML("</ul>"),
HTML(
"<ul class='small-block-grid-3 medium-block-grid-3 large-block-grid-3'>"),
"<ul class='small-block-grid-3 " +
"medium-block-grid-3 large-block-grid-3'>"),
HTML("<li>"),
'data_apresentacao',
HTML("</li>"),
@ -308,19 +310,22 @@ class FormularioSimplificadoForm(ModelForm):
HTML("</li>"),
HTML("</ul>"),
HTML(
"<ul class='small-block-grid-1 medium-block-grid-1 large-block-grid-1'>"),
"<ul class='small-block-grid-1 " +
"medium-block-grid-1 large-block-grid-1'>"),
HTML("<li>"),
'em_tramitacao',
HTML("</li>"),
HTML("</ul>"),
HTML(
"<ul class='small-block-grid-1 medium-block-grid-1 large-block-grid-1'>"),
"<ul class='small-block-grid-1 " +
"medium-block-grid-1 large-block-grid-1'>"),
HTML("<li>"),
'ementa',
HTML("</li>"),
HTML("</ul>"),
HTML(
"<ul class='small-block-grid-1 medium-block-grid-1 large-block-grid-1'>"),
"<ul class='small-block-grid-1 " +
"medium-block-grid-1 large-block-grid-1'>"),
HTML("<li>"),
'texto_original',
HTML("</li>"),
@ -458,12 +463,6 @@ class FormularioCadastroView(FormMixin, GenericView):
return reverse('formulario_cadastro')
def get_tipos_materia():
return [('', 'Selecione')] \
+ [(t.id, t.sigla + ' - ' + t.descricao)
for t in TipoMateriaLegislativa.objects.all()]
def get_tipos_documento():
return [('', 'Selecione')] \
+ [(t.id, t.descricao)
@ -533,7 +532,8 @@ class MateriaAnexadaView(FormMixin, GenericView):
error = 'A matéria a ser anexada não pode ser do mesmo \
tipo da matéria principal.'
return self.render_to_response({'error': error,
return self.render_to_response(
{'error': error,
'form': form,
'materialegislativa': mat_principal,
'anexadas': anexadas})
@ -551,14 +551,16 @@ class MateriaAnexadaView(FormMixin, GenericView):
except ObjectDoesNotExist:
error = 'A matéria a ser anexada não existe no cadastro \
de matérias legislativas.'
return self.render_to_response({'error': error,
return self.render_to_response(
{'error': error,
'form': form,
'materialegislativa': mat_principal,
'anexadas': anexadas})
return self.form_valid(form)
else:
return self.render_to_response({'form': form,
return self.render_to_response(
{'form': form,
'materialegislativa': mat_principal,
'anexadas': anexadas})
@ -637,12 +639,14 @@ class MateriaAnexadaEditView(FormMixin, GenericView):
except ObjectDoesNotExist:
error = 'A matéria a ser anexada não existe no cadastro \
de matérias legislativas.'
return self.render_to_response({'error': error,
return self.render_to_response(
{'error': error,
'form': form,
'materialegislativa': mat_principal})
else:
return self.render_to_response({'form': form,
return self.render_to_response(
{'form': form,
'materialegislativa': mat_principal})
def get_success_url(self):
@ -1394,7 +1398,8 @@ class TramitacaoForm(ModelForm):
self.helper.layout = Layout(
Fieldset('Incluir Tramitação',
HTML(
"<ul class='small-block-grid-2 medium-block-grid-2 large-block-grid-2'>"),
"<ul class='small-block-grid-2 " +
"medium-block-grid-2 large-block-grid-2'>"),
HTML("<li>"),
'data_tramitacao',
HTML("</li>"),
@ -1403,7 +1408,8 @@ class TramitacaoForm(ModelForm):
HTML("</li>"),
HTML("</ul>"),
HTML(
"<ul class='small-block-grid-3 medium-block-grid-3 large-block-grid-3'>"),
"<ul class='small-block-grid-3 " +
"medium-block-grid-3 large-block-grid-3'>"),
HTML("<li>"),
'status',
HTML("</li>"),
@ -1415,13 +1421,15 @@ class TramitacaoForm(ModelForm):
HTML("</li>"),
HTML("</ul>"),
HTML(
"<ul class='small-block-grid-1 medium-block-grid-1 large-block-grid-1'>"),
"<ul class='small-block-grid-1 " +
"medium-block-grid-1 large-block-grid-1'>"),
HTML("<li>"),
'unidade_tramitacao_destino',
HTML("</li>"),
HTML("</ul>"),
HTML(
"<ul class='small-block-grid-3 medium-block-grid-3 large-block-grid-3'>"),
"<ul class='small-block-grid-3 " +
"medium-block-grid-3 large-block-grid-3'>"),
HTML("<li>"),
'data_encaminhamento',
HTML("</li>"),
@ -1433,7 +1441,8 @@ class TramitacaoForm(ModelForm):
HTML("</li>"),
HTML("</ul>"),
HTML(
"<ul class='small-block-grid-1 medium-block-grid-1 large-block-grid-1'>"),
"<ul class='small-block-grid-1 " +
"medium-block-grid-1 large-block-grid-1'>"),
HTML("<li>"),
'texto',
HTML("</li>"),

7
painel/urls.py

@ -1,8 +1,7 @@
from django.conf.urls import include, url
from django.conf.urls import url
from .views import (controlador_painel, #cronometro_painel_crud,
cronometro_painel,
get_dados_painel, painel_mensagem_view,
from .views import controlador_painel # cronometro_painel_crud,
from .views import (cronometro_painel, get_dados_painel, painel_mensagem_view,
painel_parlamentares_view, painel_view,
painel_votacao_view)

7
painel/views.py

@ -45,6 +45,7 @@ def controlador_painel(request):
context = {'painel': painel, 'PAINEL_TYPES': Painel.PAINEL_TYPES}
return render(request, 'painel/controlador.html', context)
def painel_view(request, pk):
context = {'head_title': 'Painel Plenário', 'sessao_id': pk}
return render(request, 'painel/index.html', {'context': context})
@ -61,12 +62,12 @@ def painel_parlamentares_view(request):
def painel_votacao_view(request):
return render(request, 'painel/votacao.html')
def cronometro_painel(request):
print(request.GET['tipo'] + ' ' + request.GET['action']);
request.session[request.GET['tipo']] = request.GET['action'];
def cronometro_painel(request):
request.session[request.GET['tipo']] = request.GET['action']
return HttpResponse({})
def get_cronometro_status(request, name):
try:
cronometro = request.session[name]

1
parlamentares/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url
from parlamentares.views import (ParlamentaresView, cargo_mesa_crud,
coligacao_crud, legislatura_crud,
nivel_instrucao_crud, parlamentar_crud,

15
parlamentares/views.py

@ -1,15 +1,14 @@
from django import forms
from django.utils.translation import ugettext_lazy as _
from sapl.crud import build_crud
from vanilla import GenericView
from django import forms
from sapl.crud import build_crud
from .models import (CargoMesa, Coligacao, Dependente, Filiacao, Legislatura,
Mandato, NivelInstrucao, Parlamentar, Partido,
SessaoLegislativa, SituacaoMilitar, TipoAfastamento,
TipoDependente)
cargo_mesa_crud = build_crud(
CargoMesa, 'cargo_mesa', [
@ -48,6 +47,7 @@ partido_crud = build_crud(
('data_extincao', 2)]],
])
dependente_crud = build_crud(
Dependente, '', [
@ -57,6 +57,7 @@ dependente_crud = build_crud(
[('cpf', 4), ('rg', 4), ('titulo_eleitor', 4)]],
])
sessao_legislativa_crud = build_crud(
SessaoLegislativa, 'sessao_legislativa', [
@ -69,6 +70,7 @@ sessao_legislativa_crud = build_crud(
('data_fim_intervalo', 2)]],
])
parlamentar_crud = build_crud(
Parlamentar, '', [
@ -136,6 +138,7 @@ tipo_militar_crud = build_crud(
[('descricao', 12)]],
])
class ParlamentaresForm(forms.Form):
periodo = forms.CharField()
@ -145,7 +148,8 @@ class ParlamentaresView(GenericView):
def get(self, request, *args, **kwargs):
form = ParlamentaresForm()
legislaturas = Legislatura.objects.all().order_by('-data_inicio','-data_fim')
legislaturas = Legislatura.objects.all().order_by(
'-data_inicio', '-data_fim')
return self.render_to_response(
{'legislaturas': legislaturas,
'legislatura_id': legislaturas.first().id,
@ -156,7 +160,8 @@ class ParlamentaresView(GenericView):
def post(self, request, *args, **kwargs):
form = ParlamentaresForm(request.POST)
return self.render_to_response(
{'legislaturas': Legislatura.objects.all().order_by('-data_inicio','-data_fim'),
{'legislaturas': Legislatura.objects.all().order_by(
'-data_inicio', '-data_fim'),
'legislatura_id': int(form.data['periodo']),
'mandatos': Mandato.objects.all(),
'form': form,

5
protocoloadm/urls.py

@ -4,9 +4,8 @@ from protocoloadm.views import (AnularProtocoloAdmView,
DetailDocumentoAdministrativo,
DocumentoAcessorioAdministrativoView,
PesquisarDocumentoAdministrativo,
ProposicaoReceberView, ProposicaoView,
ProposicaoDetailView,
ProposicoesIncorporadasView,
ProposicaoDetailView, ProposicaoReceberView,
ProposicaoView, ProposicoesIncorporadasView,
ProposicoesNaoIncorporadasView,
ProposicoesNaoRecebidasView,
ProtocoloDocumentoView, ProtocoloListView,

6
protocoloadm/views.py

@ -1,7 +1,6 @@
from datetime import date, datetime
from re import sub
import sapl
from crispy_forms.helper import FormHelper
from crispy_forms.layout import ButtonHolder, Field, Fieldset, Layout, Submit
from django import forms
@ -17,9 +16,11 @@ from django.utils.translation import ugettext_lazy as _
from django.views.generic import DetailView, ListView
from django.views.generic.base import TemplateView
from django.views.generic.edit import FormMixin
from vanilla import GenericView
import sapl
from materia.models import Proposicao, TipoMateriaLegislativa
from sapl.crud import build_crud
from vanilla import GenericView
from .models import (Autor, DocumentoAcessorioAdministrativo,
DocumentoAdministrativo, Protocolo,
@ -589,6 +590,7 @@ class ProposicaoSimpleForm(forms.Form):
class ProposicaoView(TemplateView):
template_name = "protocoloadm/proposicoes.html"
class ProposicaoDetailView(DetailView):
template_name = "protocoloadm/proposicao_view.html"
model = Proposicao

Loading…
Cancel
Save