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

7
comissoes/views.py

@ -1,15 +1,14 @@
from crispy_forms.helper import FormHelper 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 import forms
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.forms import ModelForm from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView
from django.views.generic.edit import FormMixin from django.views.generic.edit import FormMixin
from vanilla import GenericView
from parlamentares.models import Filiacao, Parlamentar from parlamentares.models import Filiacao, Parlamentar
from sapl.crud import build_crud from sapl.crud import build_crud
from sessao.models import Parlamentar
from vanilla import GenericView
from .models import (CargoComissao, Comissao, Composicao, Participacao, from .models import (CargoComissao, Comissao, Composicao, Participacao,
Periodo, TipoComissao) Periodo, TipoComissao)

5
materia/urls.py

@ -1,11 +1,12 @@
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,
DocumentoAcessorioEditView, DocumentoAcessorioView, DocumentoAcessorioEditView, DocumentoAcessorioView,
FormularioCadastroView, FormularioSimplificadoView, FormularioCadastroView, FormularioSimplificadoView,
LegislacaoCitadaEditView, LegislacaoCitadaView, LegislacaoCitadaEditView, LegislacaoCitadaView,
MateriaAnexadaEditView, MateriaAnexadaView, MateriaAnexadaEditView, MateriaAnexadaView,
NumeracaoEditView, NumeracaoView, RelatoriaView, NumeracaoEditView, NumeracaoView, RelatoriaView,
TramitacaoView, TramitacaoEditView, autor_crud, TramitacaoEditView, TramitacaoView, autor_crud,
materia_legislativa_crud, orgao_crud, origem_crud, materia_legislativa_crud, orgao_crud, origem_crud,
regime_tramitacao_crud, status_tramitacao_crud, regime_tramitacao_crud, status_tramitacao_crud,
tipo_autor_crud, tipo_documento_crud, tipo_autor_crud, tipo_documento_crud,
@ -62,5 +63,5 @@ urlpatterns = [
url(r'^materia/(?P<pk>\d+)/tramitacao$', url(r'^materia/(?P<pk>\d+)/tramitacao$',
TramitacaoView.as_view(), name='tramitacao_materia'), TramitacaoView.as_view(), name='tramitacao_materia'),
url(r'^materia/(?P<pk>\d+)/tramitacao/(?P<id>\d+)/edit$', 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 datetime import date
from crispy_forms.helper import FormHelper 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 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
@ -1280,15 +1280,19 @@ class TramitacaoView(FormMixin, GenericView):
ultima_tramitacao = Tramitacao.objects.filter( ultima_tramitacao = Tramitacao.objects.filter(
materia_id=kwargs['pk']).last() 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 = form.save(commit=False)
tramitacao.materia = materia tramitacao.materia = materia
tramitacao.save() tramitacao.save()
else: else:
return self.render_to_response({'form': form, return self.render_to_response(
'materia': materia, {'form': form,
'tramitacoes': tramitacoes_list, 'materia': materia,
'error': 'A origem da nova tramitação deve ser igual ao destino da última adicionada!'}) 'tramitacoes': tramitacoes_list,
'error': 'A origem da nova tramitação \
deve ser igual ao destino da última adicionada!'})
return self.form_valid(form) return self.form_valid(form)
else: else:
return self.render_to_response({'form': form, return self.render_to_response({'form': form,

Loading…
Cancel
Save