Browse Source

Make QA tests happy again

pull/11/merge
Edward Ribeiro 9 years ago
parent
commit
197ae387b9
  1. 8
      comissoes/urls.py
  2. 7
      comissoes/views.py
  3. 5
      materia/urls.py
  4. 16
      materia/views.py

8
comissoes/urls.py

@ -1,9 +1,9 @@
from django.conf.urls import include, url
from comissoes.views import (ComposicaoView, MateriasView, ReunioesView,
cargo_crud, comissao_crud,
ComissaoParlamentarIncluirView,
periodo_composicao_crud, tipo_comissao_crud)
from comissoes.views import (ComissaoParlamentarIncluirView, ComposicaoView,
MateriasView, ReunioesView, cargo_crud,
comissao_crud, periodo_composicao_crud,
tipo_comissao_crud)
comissao_url_patterns = comissao_crud.urlpatterns + [
url(r'^(?P<pk>\d+)/composicao$',

7
comissoes/views.py

@ -1,15 +1,14 @@
from crispy_forms.helper import FormHelper
from crispy_forms.layout import ButtonHolder, Field, Fieldset, Layout, Submit
from crispy_forms.layout import ButtonHolder, Fieldset, Layout, Submit
from django import forms
from django.core.urlresolvers import reverse
from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView
from django.views.generic.edit import FormMixin
from vanilla import GenericView
from parlamentares.models import Filiacao, Parlamentar
from sapl.crud import build_crud
from sessao.models import Parlamentar
from vanilla import GenericView
from .models import (CargoComissao, Comissao, Composicao, Participacao,
Periodo, TipoComissao)

5
materia/urls.py

@ -1,11 +1,12 @@
from django.conf.urls import include, url
from materia.views import (DespachoInicialEditView, DespachoInicialView,
DocumentoAcessorioEditView, DocumentoAcessorioView,
FormularioCadastroView, FormularioSimplificadoView,
LegislacaoCitadaEditView, LegislacaoCitadaView,
MateriaAnexadaEditView, MateriaAnexadaView,
NumeracaoEditView, NumeracaoView, RelatoriaView,
TramitacaoView, TramitacaoEditView, autor_crud,
TramitacaoEditView, TramitacaoView, autor_crud,
materia_legislativa_crud, orgao_crud, origem_crud,
regime_tramitacao_crud, status_tramitacao_crud,
tipo_autor_crud, tipo_documento_crud,
@ -62,5 +63,5 @@ urlpatterns = [
url(r'^materia/(?P<pk>\d+)/tramitacao$',
TramitacaoView.as_view(), name='tramitacao_materia'),
url(r'^materia/(?P<pk>\d+)/tramitacao/(?P<id>\d+)/edit$',
TramitacaoEditView.as_view(), name='tramitacao_edit'),
TramitacaoEditView.as_view(), name='tramitacao_edit'),
]

16
materia/views.py

@ -1,7 +1,7 @@
from datetime import date
from crispy_forms.helper import FormHelper
from crispy_forms.layout import ButtonHolder, Fieldset, Layout, Submit, Field
from crispy_forms.layout import ButtonHolder, Fieldset, Layout, Submit
from django import forms
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
@ -1280,15 +1280,19 @@ class TramitacaoView(FormMixin, GenericView):
ultima_tramitacao = Tramitacao.objects.filter(
materia_id=kwargs['pk']).last()
if(ultima_tramitacao.unidade_tramitacao_destino == form.cleaned_data['unidade_tramitacao_local']):
destino = ultima_tramitacao.unidade_tramitacao_destino
cleaned_data = form.cleaned_data['unidade_tramitacao_local']
if (destino == cleaned_data):
tramitacao = form.save(commit=False)
tramitacao.materia = materia
tramitacao.save()
else:
return self.render_to_response({'form': form,
'materia': materia,
'tramitacoes': tramitacoes_list,
'error': 'A origem da nova tramitação deve ser igual ao destino da última adicionada!'})
return self.render_to_response(
{'form': form,
'materia': materia,
'tramitacoes': tramitacoes_list,
'error': 'A origem da nova tramitação \
deve ser igual ao destino da última adicionada!'})
return self.form_valid(form)
else:
return self.render_to_response({'form': form,

Loading…
Cancel
Save