diff --git a/comissoes/urls.py b/comissoes/urls.py index bad1cf773..93c43cea3 100644 --- a/comissoes/urls.py +++ b/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\d+)/composicao$', diff --git a/comissoes/views.py b/comissoes/views.py index 20232a01f..43f753989 100644 --- a/comissoes/views.py +++ b/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) diff --git a/materia/urls.py b/materia/urls.py index b80af311d..c6be58a32 100644 --- a/materia/urls.py +++ b/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\d+)/tramitacao$', TramitacaoView.as_view(), name='tramitacao_materia'), url(r'^materia/(?P\d+)/tramitacao/(?P\d+)/edit$', - TramitacaoEditView.as_view(), name='tramitacao_edit'), + TramitacaoEditView.as_view(), name='tramitacao_edit'), ] diff --git a/materia/views.py b/materia/views.py index f5ce765fb..4a066ce28 100644 --- a/materia/views.py +++ b/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,