diff --git a/comissoes/views.py b/comissoes/views.py index afc10fe15..707cca925 100644 --- a/comissoes/views.py +++ b/comissoes/views.py @@ -21,7 +21,7 @@ ComissaoCrud = Crud.build(Comissao, 'modulo_comissoes') class CadastrarComissaoView(CreateView): template_name = "comissoes/cadastrar_comissao.html" form_class = CadastrarComissaoForm - success_url = reverse_lazy('comissoes') + success_url = reverse_lazy('comissao') class ComposicaoView(FormView): diff --git a/materia/views.py b/materia/views.py index 97272335e..fd1d6e49c 100644 --- a/materia/views.py +++ b/materia/views.py @@ -58,7 +58,7 @@ TramitacaoCrud = Crud.build(Tramitacao, '') class FormularioSimplificadoView(CreateView): template_name = "materia/formulario_simplificado.html" form_class = FormularioSimplificadoForm - success_url = reverse_lazy('materia:materia_list') + success_url = reverse_lazy('materia:materialegislativa_list') class FormularioCadastroView(CreateView): @@ -144,7 +144,7 @@ class MateriaAnexadaView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('materia_anexada', kwargs={'pk': pk}) + return reverse('materia:materia_anexada', kwargs={'pk': pk}) class MateriaAnexadaEditView(FormView): @@ -262,7 +262,7 @@ class DespachoInicialView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('despacho_inicial', kwargs={'pk': pk}) + return reverse('materia:despacho_inicial', kwargs={'pk': pk}) class DespachoInicialEditView(CreateView): @@ -458,7 +458,7 @@ class NumeracaoView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('numeracao', kwargs={'pk': pk}) + return reverse('materia:numeracao', kwargs={'pk': pk}) class NumeracaoEditView(CreateView): @@ -533,7 +533,7 @@ class DocumentoAcessorioView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('documento_acessorio', kwargs={'pk': pk}) + return reverse('materia:documento_acessorio', kwargs={'pk': pk}) class AcompanhamentoConfirmarView(TemplateView): @@ -1361,7 +1361,7 @@ class ProposicaoEditView(CreateView): form_class = ProposicaoForm def get_success_url(self): - return reverse('list_proposicao') + return reverse('materia:list_proposicao') def get(self, request, *args, **kwargs): proposicao = Proposicao.objects.get(id=kwargs['pk']) diff --git a/norma/views.py b/norma/views.py index 3594f38d2..fd06f2a5e 100644 --- a/norma/views.py +++ b/norma/views.py @@ -42,7 +42,7 @@ class NormaPesquisaView(FormView): kwargs['publicacao_final'] = form.data['publicacao_final'] request.session['kwargs'] = kwargs - return redirect('list_pesquisa_norma') + return redirect('norma:list_pesquisa_norma') class PesquisaNormaListView(ListView): @@ -113,7 +113,7 @@ class PesquisaNormaListView(ListView): class NormaIncluirView(CreateView): template_name = "norma/normajuridica_incluir.html" form_class = NormaJuridicaForm - success_url = reverse_lazy('norma:list') + success_url = reverse_lazy('norma') def form_valid(self, form): norma = form.save(commit=False) diff --git a/parlamentares/views.py b/parlamentares/views.py index 46ccf6128..7670a99ba 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -175,7 +175,7 @@ class ParlamentaresCadastroView(CreateView): model = Parlamentar def get_success_url(self): - return reverse('parlamentares') + return reverse('parlamentares:parlamentares') def get_context_data(self, **kwargs): context = super(ParlamentaresCadastroView, self).get_context_data( @@ -223,7 +223,8 @@ class ParlamentaresDependentesView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('parlamentares_dependentes', kwargs={'pk': pk}) + return reverse('parlamentares:parlamentares_dependentes', + kwargs={'pk': pk}) def get_context_data(self, **kwargs): context = super(ParlamentaresDependentesView, self).\ @@ -256,7 +257,8 @@ class ParlamentaresDependentesEditView(UpdateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('parlamentares_dependentes', kwargs={'pk': pk}) + return reverse('parlamentares:parlamentares_dependentes', + kwargs={'pk': pk}) def get_context_data(self, **kwargs): context = super(ParlamentaresDependentesEditView, self).\ @@ -398,7 +400,8 @@ class FiliacaoView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('parlamentares_filiacao', kwargs={'pk': pk}) + return reverse('parlamentares:parlamentares_filiacao', + kwargs={'pk': pk}) def get_context_data(self, **kwargs): context = super(FiliacaoView, self).get_context_data(**kwargs) @@ -432,7 +435,8 @@ class FiliacaoEditView(UpdateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('parlamentares_filiacao', kwargs={'pk': pk}) + return reverse('parlamentares:parlamentares_filiacao', + kwargs={'pk': pk}) def get_context_data(self, **kwargs): context = super(FiliacaoEditView, self).get_context_data(**kwargs) @@ -465,7 +469,8 @@ class MandatoView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('parlamentares_mandato', kwargs={'pk': pk}) + return reverse('parlamentares:parlamentares_mandato', + kwargs={'pk': pk}) def get_context_data(self, **kwargs): context = super(MandatoView, self).get_context_data(**kwargs) diff --git a/protocoloadm/views.py b/protocoloadm/views.py index 6153d9481..4ad417985 100644 --- a/protocoloadm/views.py +++ b/protocoloadm/views.py @@ -87,7 +87,7 @@ class ProtocoloPesquisaView(FormView): kwargs['assunto_ementa__icontains'] = request.POST['assunto'] request.session['kwargs'] = kwargs - return redirect('protocolo_list') + return redirect('protocoloadm:protocolo_list') else: return self.form_invalid(form) @@ -118,7 +118,7 @@ class ProtocoloListView(ListView): class AnularProtocoloAdmView(FormView): template_name = 'protocoloadm/anular_protocoloadm.html' form_class = AnularProcoloAdmForm - success_url = reverse_lazy('anular_protocolo') + success_url = reverse_lazy('protocoloadm:anular_protocolo') form_valid_message = _('Protocolo anulado com sucesso!') def get_initial(self): @@ -154,7 +154,7 @@ class ProtocoloDocumentoView(FormValidMessageMixin, FormView): template_name = "protocoloadm/protocolar_documento.html" form_class = ProtocoloDocumentForm - success_url = reverse_lazy('protocolo') + success_url = reverse_lazy('protocoloadm:protocolo') form_valid_message = _('Protocolo cadastrado com sucesso!') def post(self, request, *args, **kwargs): @@ -209,8 +209,9 @@ class CriarDocumentoProtocolo(CreateView): return self.criar_documento(protocolo) def get_success_url(self): - return reverse('protocolo_mostrar', kwargs={'pk': self.kwargs['pk'], - 'ano': self.kwargs['ano']}) + return reverse('protocoloadm:protocolo_mostrar', + kwargs={'pk': self.kwargs['pk'], + 'ano': self.kwargs['ano']}) def criar_documento(self, protocolo): @@ -281,9 +282,10 @@ class ProtocoloMateriaView(FormView): form_valid_message = _('Matéria cadastrada com sucesso!') def get_success_url(self): - return reverse('protocolo') + return reverse('protocoloadm:protocolo') def post(self, request, *args, **kwargs): + # import ipdb; ipdb.set_trace() form = ProtocoloMateriaForm(request.POST) @@ -306,7 +308,8 @@ class ProtocoloMateriaView(FormView): protocolo.timestamp = datetime.now().strftime("%Y-%m-%d %H:%M") protocolo.tipo_protocolo = request.POST['tipo_protocolo'] protocolo.tipo_processo = '0' # TODO validar o significado - protocolo.autor = Autor.objects.get(id=request.POST['autor']) + if request.POST['autor'] != '': + protocolo.autor = Autor.objects.get(id=request.POST['autor']) protocolo.anulado = False protocolo.tipo_materia = TipoMateriaLegislativa.objects.get( id=request.POST['tipo_materia']) @@ -479,10 +482,10 @@ class DetailDocumentoAdministrativo(DetailView): return HttpResponseRedirect(self.get_success_url()) def get_success_delete(self): - return reverse('pesq_doc_adm') + return reverse('protocoloadm:pesq_doc_adm') def get_success_url(self): - return reverse('detail_doc_adm', kwargs={ + return reverse('protocoloadm:detail_doc_adm', kwargs={ 'pk': self.kwargs['pk']}) @@ -530,7 +533,7 @@ class DocumentoAcessorioAdministrativoEditView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('doc_ace_adm', kwargs={'pk': pk}) + return reverse('protocoloadm:doc_ace_adm', kwargs={'pk': pk}) class DocumentoAcessorioAdministrativoView(FormView): @@ -569,7 +572,7 @@ class DocumentoAcessorioAdministrativoView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('doc_ace_adm', kwargs={'pk': pk}) + return reverse('protocoloadm:doc_ace_adm', kwargs={'pk': pk}) class TramitacaoAdmView(FormView): @@ -605,8 +608,7 @@ class TramitacaoAdmIncluirView(FormView): tramitacao = form.save(commit=False) tramitacao.ultima = False tramitacao.save() - return HttpResponseRedirect( - reverse('tramitacao', kwargs={'pk': pk})) + return reverse('protocoloadm:tramitacao', kwargs={'pk': pk}) else: return self.form_invalid(form) @@ -633,7 +635,8 @@ class TramitacaoAdmEditView(FormView): tramitacao.ultima = False tramitacao.save() return HttpResponseRedirect( - reverse('tramitacao', kwargs={'pk': tramitacao.documento.id})) + reverse('protocoloadm:tramitacao', + kwargs={'pk': tramitacao.documento.id})) else: return self.form_invalid(form) diff --git a/sessao/forms.py b/sessao/forms.py index 0f44294d9..f8b526f2d 100644 --- a/sessao/forms.py +++ b/sessao/forms.py @@ -93,19 +93,19 @@ class SessaoForm(ModelForm): 'hora_fim': forms.TextInput(attrs={'class': 'hora'}), } - def clean_url_audio(self): - url_audio = self.cleaned_data.get('url_audio', False) - if url_audio: - if url_audio.size > 5*1024*1024: - raise ValidationError("Arquivo muito grande. ( > 5mb )") - return url_audio - - def clean_url_video(self): - url_video = self.cleaned_data.get('url_video', False) - if url_video: - if url_video.size > 5*1024*1024: - raise ValidationError("Arquivo muito grande. ( > 5mb )") - return url_video + # def clean_url_audio(self): + # url_audio = self.cleaned_data.get('url_audio', False) + # if url_audio: + # if url_audio.size > 5*1024*1024: + # raise ValidationError("Arquivo muito grande. ( > 5mb )") + # return url_audio + + # def clean_url_video(self): + # url_video = self.cleaned_data.get('url_video', False) + # if url_video: + # if url_video.size > 5*1024*1024: + # raise ValidationError("Arquivo muito grande. ( > 5mb )") + # return url_video def __init__(self, *args, **kwargs): diff --git a/templates/materia/autoria.html b/templates/materia/autoria.html index d90febf81..d1e79e695 100644 --- a/templates/materia/autoria.html +++ b/templates/materia/autoria.html @@ -20,7 +20,7 @@ {% for a in autorias %}