|
@ -1,8 +1,6 @@ |
|
|
from datetime import date, datetime |
|
|
from datetime import date |
|
|
from re import sub |
|
|
from re import sub |
|
|
|
|
|
|
|
|
import sapl |
|
|
|
|
|
from comissoes.models import Comissao, Composicao |
|
|
|
|
|
from crispy_forms.helper import FormHelper |
|
|
from crispy_forms.helper import FormHelper |
|
|
from crispy_forms.layout import (HTML, ButtonHolder, Column, Fieldset, Layout, |
|
|
from crispy_forms.layout import (HTML, ButtonHolder, Column, Fieldset, Layout, |
|
|
Submit) |
|
|
Submit) |
|
@ -14,11 +12,13 @@ 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 _ |
|
|
from django.views.generic import ListView |
|
|
from django.views.generic import ListView |
|
|
from django.views.generic.detail import SingleObjectMixin |
|
|
|
|
|
from django.views.generic.edit import FormMixin |
|
|
from django.views.generic.edit import FormMixin |
|
|
|
|
|
from vanilla import GenericView |
|
|
|
|
|
|
|
|
|
|
|
import sapl |
|
|
|
|
|
from comissoes.models import Comissao, Composicao |
|
|
from norma.models import LegislacaoCitada, NormaJuridica, TipoNormaJuridica |
|
|
from norma.models import LegislacaoCitada, NormaJuridica, TipoNormaJuridica |
|
|
from sapl.crud import build_crud |
|
|
from sapl.crud import build_crud |
|
|
from vanilla import GenericView |
|
|
|
|
|
|
|
|
|
|
|
from .models import (Anexada, Autor, Autoria, DespachoInicial, |
|
|
from .models import (Anexada, Autor, Autoria, DespachoInicial, |
|
|
DocumentoAcessorio, MateriaLegislativa, Numeracao, Orgao, |
|
|
DocumentoAcessorio, MateriaLegislativa, Numeracao, Orgao, |
|
@ -284,7 +284,8 @@ class FormularioSimplificadoForm(ModelForm): |
|
|
Fieldset( |
|
|
Fieldset( |
|
|
'Identificação Básica', |
|
|
'Identificação Básica', |
|
|
HTML( |
|
|
HTML( |
|
|
"<ul class='small-block-grid-3 medium-block-grid-3 large-block-grid-3'>"), |
|
|
"<ul class='small-block-grid-3 " + |
|
|
|
|
|
"medium-block-grid-3 large-block-grid-3'>"), |
|
|
HTML("<li>"), |
|
|
HTML("<li>"), |
|
|
'tipo', |
|
|
'tipo', |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
@ -296,7 +297,8 @@ class FormularioSimplificadoForm(ModelForm): |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
|
HTML("</ul>"), |
|
|
HTML("</ul>"), |
|
|
HTML( |
|
|
HTML( |
|
|
"<ul class='small-block-grid-3 medium-block-grid-3 large-block-grid-3'>"), |
|
|
"<ul class='small-block-grid-3 " + |
|
|
|
|
|
"medium-block-grid-3 large-block-grid-3'>"), |
|
|
HTML("<li>"), |
|
|
HTML("<li>"), |
|
|
'data_apresentacao', |
|
|
'data_apresentacao', |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
@ -308,19 +310,22 @@ class FormularioSimplificadoForm(ModelForm): |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
|
HTML("</ul>"), |
|
|
HTML("</ul>"), |
|
|
HTML( |
|
|
HTML( |
|
|
"<ul class='small-block-grid-1 medium-block-grid-1 large-block-grid-1'>"), |
|
|
"<ul class='small-block-grid-1 " + |
|
|
|
|
|
"medium-block-grid-1 large-block-grid-1'>"), |
|
|
HTML("<li>"), |
|
|
HTML("<li>"), |
|
|
'em_tramitacao', |
|
|
'em_tramitacao', |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
|
HTML("</ul>"), |
|
|
HTML("</ul>"), |
|
|
HTML( |
|
|
HTML( |
|
|
"<ul class='small-block-grid-1 medium-block-grid-1 large-block-grid-1'>"), |
|
|
"<ul class='small-block-grid-1 " + |
|
|
|
|
|
"medium-block-grid-1 large-block-grid-1'>"), |
|
|
HTML("<li>"), |
|
|
HTML("<li>"), |
|
|
'ementa', |
|
|
'ementa', |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
|
HTML("</ul>"), |
|
|
HTML("</ul>"), |
|
|
HTML( |
|
|
HTML( |
|
|
"<ul class='small-block-grid-1 medium-block-grid-1 large-block-grid-1'>"), |
|
|
"<ul class='small-block-grid-1 " + |
|
|
|
|
|
"medium-block-grid-1 large-block-grid-1'>"), |
|
|
HTML("<li>"), |
|
|
HTML("<li>"), |
|
|
'texto_original', |
|
|
'texto_original', |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
@ -458,12 +463,6 @@ class FormularioCadastroView(FormMixin, GenericView): |
|
|
return reverse('formulario_cadastro') |
|
|
return reverse('formulario_cadastro') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_tipos_materia(): |
|
|
|
|
|
return [('', 'Selecione')] \ |
|
|
|
|
|
+ [(t.id, t.sigla + ' - ' + t.descricao) |
|
|
|
|
|
for t in TipoMateriaLegislativa.objects.all()] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_tipos_documento(): |
|
|
def get_tipos_documento(): |
|
|
return [('', 'Selecione')] \ |
|
|
return [('', 'Selecione')] \ |
|
|
+ [(t.id, t.descricao) |
|
|
+ [(t.id, t.descricao) |
|
@ -533,7 +532,8 @@ class MateriaAnexadaView(FormMixin, GenericView): |
|
|
|
|
|
|
|
|
error = 'A matéria a ser anexada não pode ser do mesmo \ |
|
|
error = 'A matéria a ser anexada não pode ser do mesmo \ |
|
|
tipo da matéria principal.' |
|
|
tipo da matéria principal.' |
|
|
return self.render_to_response({'error': error, |
|
|
return self.render_to_response( |
|
|
|
|
|
{'error': error, |
|
|
'form': form, |
|
|
'form': form, |
|
|
'materialegislativa': mat_principal, |
|
|
'materialegislativa': mat_principal, |
|
|
'anexadas': anexadas}) |
|
|
'anexadas': anexadas}) |
|
@ -551,14 +551,16 @@ class MateriaAnexadaView(FormMixin, GenericView): |
|
|
except ObjectDoesNotExist: |
|
|
except ObjectDoesNotExist: |
|
|
error = 'A matéria a ser anexada não existe no cadastro \ |
|
|
error = 'A matéria a ser anexada não existe no cadastro \ |
|
|
de matérias legislativas.' |
|
|
de matérias legislativas.' |
|
|
return self.render_to_response({'error': error, |
|
|
return self.render_to_response( |
|
|
|
|
|
{'error': error, |
|
|
'form': form, |
|
|
'form': form, |
|
|
'materialegislativa': mat_principal, |
|
|
'materialegislativa': mat_principal, |
|
|
'anexadas': anexadas}) |
|
|
'anexadas': anexadas}) |
|
|
|
|
|
|
|
|
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, |
|
|
'materialegislativa': mat_principal, |
|
|
'materialegislativa': mat_principal, |
|
|
'anexadas': anexadas}) |
|
|
'anexadas': anexadas}) |
|
|
|
|
|
|
|
@ -637,12 +639,14 @@ class MateriaAnexadaEditView(FormMixin, GenericView): |
|
|
except ObjectDoesNotExist: |
|
|
except ObjectDoesNotExist: |
|
|
error = 'A matéria a ser anexada não existe no cadastro \ |
|
|
error = 'A matéria a ser anexada não existe no cadastro \ |
|
|
de matérias legislativas.' |
|
|
de matérias legislativas.' |
|
|
return self.render_to_response({'error': error, |
|
|
return self.render_to_response( |
|
|
|
|
|
{'error': error, |
|
|
'form': form, |
|
|
'form': form, |
|
|
'materialegislativa': mat_principal}) |
|
|
'materialegislativa': mat_principal}) |
|
|
|
|
|
|
|
|
else: |
|
|
else: |
|
|
return self.render_to_response({'form': form, |
|
|
return self.render_to_response( |
|
|
|
|
|
{'form': form, |
|
|
'materialegislativa': mat_principal}) |
|
|
'materialegislativa': mat_principal}) |
|
|
|
|
|
|
|
|
def get_success_url(self): |
|
|
def get_success_url(self): |
|
@ -1394,7 +1398,8 @@ class TramitacaoForm(ModelForm): |
|
|
self.helper.layout = Layout( |
|
|
self.helper.layout = Layout( |
|
|
Fieldset('Incluir Tramitação', |
|
|
Fieldset('Incluir Tramitação', |
|
|
HTML( |
|
|
HTML( |
|
|
"<ul class='small-block-grid-2 medium-block-grid-2 large-block-grid-2'>"), |
|
|
"<ul class='small-block-grid-2 " + |
|
|
|
|
|
"medium-block-grid-2 large-block-grid-2'>"), |
|
|
HTML("<li>"), |
|
|
HTML("<li>"), |
|
|
'data_tramitacao', |
|
|
'data_tramitacao', |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
@ -1403,7 +1408,8 @@ class TramitacaoForm(ModelForm): |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
|
HTML("</ul>"), |
|
|
HTML("</ul>"), |
|
|
HTML( |
|
|
HTML( |
|
|
"<ul class='small-block-grid-3 medium-block-grid-3 large-block-grid-3'>"), |
|
|
"<ul class='small-block-grid-3 " + |
|
|
|
|
|
"medium-block-grid-3 large-block-grid-3'>"), |
|
|
HTML("<li>"), |
|
|
HTML("<li>"), |
|
|
'status', |
|
|
'status', |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
@ -1415,13 +1421,15 @@ class TramitacaoForm(ModelForm): |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
|
HTML("</ul>"), |
|
|
HTML("</ul>"), |
|
|
HTML( |
|
|
HTML( |
|
|
"<ul class='small-block-grid-1 medium-block-grid-1 large-block-grid-1'>"), |
|
|
"<ul class='small-block-grid-1 " + |
|
|
|
|
|
"medium-block-grid-1 large-block-grid-1'>"), |
|
|
HTML("<li>"), |
|
|
HTML("<li>"), |
|
|
'unidade_tramitacao_destino', |
|
|
'unidade_tramitacao_destino', |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
|
HTML("</ul>"), |
|
|
HTML("</ul>"), |
|
|
HTML( |
|
|
HTML( |
|
|
"<ul class='small-block-grid-3 medium-block-grid-3 large-block-grid-3'>"), |
|
|
"<ul class='small-block-grid-3 " + |
|
|
|
|
|
"medium-block-grid-3 large-block-grid-3'>"), |
|
|
HTML("<li>"), |
|
|
HTML("<li>"), |
|
|
'data_encaminhamento', |
|
|
'data_encaminhamento', |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
@ -1433,7 +1441,8 @@ class TramitacaoForm(ModelForm): |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
|
HTML("</ul>"), |
|
|
HTML("</ul>"), |
|
|
HTML( |
|
|
HTML( |
|
|
"<ul class='small-block-grid-1 medium-block-grid-1 large-block-grid-1'>"), |
|
|
"<ul class='small-block-grid-1 " + |
|
|
|
|
|
"medium-block-grid-1 large-block-grid-1'>"), |
|
|
HTML("<li>"), |
|
|
HTML("<li>"), |
|
|
'texto', |
|
|
'texto', |
|
|
HTML("</li>"), |
|
|
HTML("</li>"), |
|
|