Browse Source

Fix QA check

pull/11/merge
Edward Ribeiro 9 years ago
parent
commit
fd95d598fb
  1. 2
      materia/models.py
  2. 1
      materia/urls.py
  3. 1
      norma/urls.py
  4. 16
      protocoloadm/urls.py
  5. 33
      protocoloadm/views.py

2
materia/models.py

@ -236,7 +236,7 @@ class DespachoInicial(models.Model):
# TODO M2M? # TODO M2M?
materia = models.ForeignKey(MateriaLegislativa) materia = models.ForeignKey(MateriaLegislativa)
comissao = models.ForeignKey(Comissao) comissao = models.ForeignKey(Comissao)
class Meta: class Meta:
verbose_name = _('Despacho Inicial') verbose_name = _('Despacho Inicial')
verbose_name_plural = _('Despachos Iniciais') verbose_name_plural = _('Despachos Iniciais')

1
materia/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url from django.conf.urls import include, url
from materia.views import (DespachoInicialEditView, DespachoInicialView, from materia.views import (DespachoInicialEditView, DespachoInicialView,
FormularioCadastroView, FormularioSimplificadoView, FormularioCadastroView, FormularioSimplificadoView,
LegislacaoCitadaEditView, LegislacaoCitadaView, LegislacaoCitadaEditView, LegislacaoCitadaView,

1
norma/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import url from django.conf.urls import url
from norma.views import NormaIncluirView, norma_temporario_para_compilacao_crud from norma.views import NormaIncluirView, norma_temporario_para_compilacao_crud
norma_url_patterns = norma_temporario_para_compilacao_crud.urlpatterns norma_url_patterns = norma_temporario_para_compilacao_crud.urlpatterns

16
protocoloadm/urls.py

@ -10,17 +10,15 @@ from protocoloadm.views import (AnularProtocoloAdmView,
ProposicoesNaoRecebidasView, ProposicoesNaoRecebidasView,
ProtocoloDocumentoView, ProtocoloListView, ProtocoloDocumentoView, ProtocoloListView,
ProtocoloMateriaView, ProtocoloPesquisaView, ProtocoloMateriaView, ProtocoloPesquisaView,
TramitacaoAdmDeleteView, TramitacaoAdmEditView,
TramitacaoAdmIncluirView, TramitacaoAdmView,
documento_acessorio_administrativo_crud, documento_acessorio_administrativo_crud,
documento_administrativo_crud, documento_administrativo_crud,
protocolo_documento_crud, protocolo_documento_crud,
protocolo_materia_crud, protocolo_materia_crud,
status_tramitacao_administrativo_crud, status_tramitacao_administrativo_crud,
tipo_documento_administrativo_crud, tipo_documento_administrativo_crud,
tramitacao_administrativo_crud, tramitacao_administrativo_crud)
TramitacaoAdmView,
TramitacaoAdmEditView,
TramitacaoAdmIncluirView,
TramitacaoAdmDeleteView)
urlpatterns = [ urlpatterns = [
url(r'^protocoloadm/docadm/', include(documento_administrativo_crud.urls)), url(r'^protocoloadm/docadm/', include(documento_administrativo_crud.urls)),
@ -57,12 +55,12 @@ urlpatterns = [
url(r'^protocoloadm/(?P<pk>\d+)/tramitacao$', url(r'^protocoloadm/(?P<pk>\d+)/tramitacao$',
TramitacaoAdmView.as_view(), name='tramitacao'), TramitacaoAdmView.as_view(), name='tramitacao'),
url(r'^protocoloadm/(?P<pk>\d+)/tramitacao_incluir', url(r'^protocoloadm/(?P<pk>\d+)/tramitacao_incluir',
TramitacaoAdmIncluirView.as_view(), name='tramitacao_incluir'), TramitacaoAdmIncluirView.as_view(), name='tramitacao_incluir'),
url(r'^protocoloadm/(?P<pk>\d+)/tramitacao_edit', url(r'^protocoloadm/(?P<pk>\d+)/tramitacao_edit',
TramitacaoAdmEditView.as_view(), name='tramitacao_edit'), TramitacaoAdmEditView.as_view(), name='tramitacao_edit'),
url(r'^protocoloadm/(?P<pk>\d+)/tramitacao_delete/(?P<oid>\d+)', url(r'^protocoloadm/(?P<pk>\d+)/tramitacao_delete/(?P<oid>\d+)',
TramitacaoAdmDeleteView.as_view(), name='tramitacao_delete'), TramitacaoAdmDeleteView.as_view(), name='tramitacao_delete'),
# TODO: move to Proposicoes app # TODO: move to Proposicoes app
@ -78,5 +76,5 @@ urlpatterns = [
ProposicoesIncorporadasView.as_view(), ProposicoesIncorporadasView.as_view(),
name='proposicoes_incorporadas'), name='proposicoes_incorporadas'),
url(r'^protocoloadm/(?P<pk>\d+)/proposicao', url(r'^protocoloadm/(?P<pk>\d+)/proposicao',
ProposicaoView.as_view(), name='proposicao_view'), ProposicaoView.as_view(), name='proposicao_view'),
] ]

33
protocoloadm/views.py

@ -2,7 +2,7 @@ from datetime import date, datetime
from re import sub from re import sub
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms.layout import ButtonHolder, Fieldset, Field, Layout, Submit from crispy_forms.layout import ButtonHolder, Field, Fieldset, Layout, Submit
from django import forms from django import forms
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
@ -10,7 +10,6 @@ from django.db.models import Max
from django.forms import ModelForm from django.forms import ModelForm
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.shortcuts import render from django.shortcuts import render
from django.utils.html import strip_tags from django.utils.html import strip_tags
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
@ -811,7 +810,8 @@ class TramitacaoAdmView(FormMixin, GenericView):
tramitacoes = TramitacaoAdministrativo.objects.filter( tramitacoes = TramitacaoAdministrativo.objects.filter(
documento=documento).order_by('-data_tramitacao') documento=documento).order_by('-data_tramitacao')
return self.render_to_response({'documento': documento, 'tramitacoes': tramitacoes}) return self.render_to_response({'documento': documento,
'tramitacoes': tramitacoes})
class TramitacaoAdmForm(ModelForm): class TramitacaoAdmForm(ModelForm):
@ -819,20 +819,23 @@ class TramitacaoAdmForm(ModelForm):
data_tramitacao = forms.DateField(label=u'Data Tramitação', data_tramitacao = forms.DateField(label=u'Data Tramitação',
input_formats=['%d/%m/%Y'], input_formats=['%d/%m/%Y'],
required=False, required=False,
widget=forms.DateInput(format='%d/%m/%Y', widget=forms.DateInput(
attrs={'class': 'dateinput'})) format='%d/%m/%Y',
attrs={'class': 'dateinput'}))
data_encaminhamento = forms.DateField(label=u'Data Encaminhamento', data_encaminhamento = forms.DateField(label=u'Data Encaminhamento',
input_formats=['%d/%m/%Y'], input_formats=['%d/%m/%Y'],
required=False, required=False,
widget=forms.DateInput(format='%d/%m/%Y', widget=forms.DateInput(
attrs={'class': 'dateinput'})) format='%d/%m/%Y',
attrs={'class': 'dateinput'}))
data_fim_prazo = forms.DateField(label=u'Data Fim Prazo', data_fim_prazo = forms.DateField(label=u'Data Fim Prazo',
input_formats=['%d/%m/%Y'], input_formats=['%d/%m/%Y'],
required=False, required=False,
widget=forms.DateInput(format='%d/%m/%Y', widget=forms.DateInput(
attrs={'class': 'dateinput'})) format='%d/%m/%Y',
attrs={'class': 'dateinput'}))
class Meta: class Meta:
model = TramitacaoAdministrativo model = TramitacaoAdministrativo
@ -880,15 +883,14 @@ class TramitacaoAdmIncluirView(FormMixin, GenericView):
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
pk = kwargs['pk'] pk = kwargs['pk']
documento = DocumentoAdministrativo.objects.get(id=pk)
form = TramitacaoAdmForm(request.POST or None) form = TramitacaoAdmForm(request.POST or None)
if form.is_valid(): if form.is_valid():
tramitacao = form.save(commit=False) tramitacao = form.save(commit=False)
tramitacao.ultima = False tramitacao.ultima = False
tramitacao.save() tramitacao.save()
message = "Tramitação criada com sucesso" return HttpResponseRedirect(
return HttpResponseRedirect(reverse('tramitacao', kwargs={'pk': pk})) reverse('tramitacao', kwargs={'pk': pk}))
else: else:
return self.form_invalid(form) return self.form_invalid(form)
@ -908,14 +910,14 @@ class TramitacaoAdmEditView(FormMixin, GenericView):
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
pk = kwargs['pk'] pk = kwargs['pk']
tramitacao = TramitacaoAdministrativo.objects.get(id=pk) tramitacao = TramitacaoAdministrativo.objects.get(id=pk)
documento = tramitacao.documento
form = TramitacaoAdmForm(request.POST, instance=tramitacao) form = TramitacaoAdmForm(request.POST, instance=tramitacao)
if form.is_valid(): if form.is_valid():
tramitacao = form.save(commit=False) tramitacao = form.save(commit=False)
tramitacao.ultima = False tramitacao.ultima = False
tramitacao.save() tramitacao.save()
return HttpResponseRedirect(reverse('tramitacao', kwargs={'pk': pk})) return HttpResponseRedirect(
reverse('tramitacao', kwargs={'pk': pk}))
else: else:
return self.form_invalid(form) return self.form_invalid(form)
@ -935,4 +937,5 @@ class TramitacaoAdmDeleteView(FormMixin, GenericView):
tramitacoes = TramitacaoAdministrativo.objects.filter( tramitacoes = TramitacaoAdministrativo.objects.filter(
documento=documento) documento=documento)
return self.render_to_response({'documento': documento, 'tramitacoes': tramitacoes}) return self.render_to_response({'documento': documento,
'tramitacoes': tramitacoes})

Loading…
Cancel
Save