Browse Source

Merge branch 'master' of github.com:interlegis/sapl

pull/675/head
Eduardo Calil 8 years ago
parent
commit
ba4a30a264
  1. 0
      sapl/legacy/management/__init__.py
  2. 0
      sapl/legacy/management/commands/__init__.py
  3. 9
      sapl/legacy/management/commands/migracao_25_31.py
  4. 6
      sapl/materia/forms.py
  5. 4
      sapl/materia/urls.py
  6. 14
      sapl/materia/views.py
  7. 19
      sapl/norma/migrations/0015_auto_20160929_1635.py
  8. 4
      sapl/norma/models.py
  9. 1
      sapl/parlamentares/legacy.yaml
  10. 25
      sapl/templates/materia/materialegislativa_form.html
  11. 14
      sapl/templates/materia/relatoria_form.html

0
sapl/legacy/management/__init__.py

0
sapl/legacy/management/commands/__init__.py

9
sapl/legacy/management/commands/migracao_25_31.py

@ -0,0 +1,9 @@
from django.core.management.base import BaseCommand
from sapl.legacy import migration
class Command(BaseCommand):
help = u'Faz a migração de dados do SAPL 2.5 para o SAPL 3.1'
def handle(self, *args, **options):
migration.migrate()

6
sapl/materia/forms.py

@ -17,6 +17,7 @@ from sapl.comissoes.models import Comissao
from sapl.crispy_layout_mixin import form_actions, to_row
from sapl.norma.models import (LegislacaoCitada, NormaJuridica,
TipoNormaJuridica)
from sapl.parlamentares.models import Parlamentar
from sapl.settings import MAX_DOC_UPLOAD_SIZE
from sapl.utils import (RANGE_ANOS, RangeWidgetOverride, autor_label,
autor_modal)
@ -190,6 +191,11 @@ class RelatoriaForm(ModelForm):
widgets = {'comissao': forms.Select(attrs={'disabled': 'disabled'})}
def __init__(self, *args, **kwargs):
super(RelatoriaForm, self).__init__(*args, **kwargs)
self.fields['parlamentar'].queryset = Parlamentar.objects.filter(
ativo=True).order_by('nome_completo')
def clean(self):
cleaned_data = self.cleaned_data

4
sapl/materia/urls.py

@ -19,7 +19,7 @@ from sapl.materia.views import (AcompanhamentoConfirmarView,
TipoDocumentoCrud, TipoFimRelatoriaCrud,
TipoMateriaCrud, TipoProposicaoCrud,
TramitacaoCrud, TramitacaoEmLoteView,
UnidadeTramitacaoCrud)
UnidadeTramitacaoCrud, recuperar_materia)
from .apps import AppConfig
@ -36,6 +36,8 @@ urlpatterns = [
RelatoriaCrud.get_urls() +
DocumentoAcessorioCrud.get_urls())),
url(r'^materia/recuperar-materia', recuperar_materia),
url(r'''^confirmar/(?P<uidb64>[0-9A-Za-z_\-]+)/
(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})$''',
ConfirmarEmailView.as_view(), name='confirmar_email'),

14
sapl/materia/views.py

@ -13,6 +13,7 @@ from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.http import JsonResponse
from django.http.response import HttpResponseRedirect
from django.shortcuts import redirect
from django.template import Context, loader
@ -54,10 +55,21 @@ from .models import (AcompanhamentoMateria, Anexada, Autor, Autoria,
TipoFimRelatoria, TipoMateriaLegislativa, TipoProposicao,
Tramitacao, UnidadeTramitacao)
AnexadaCrud = Crud.build(Anexada, '')
def recuperar_materia(request):
tipo = TipoMateriaLegislativa.objects.get(pk=request.GET['tipo'])
materia = MateriaLegislativa.objects.filter(tipo=tipo).last()
if materia:
response = JsonResponse({'numero': materia.numero + 1,
'ano': datetime.now().year})
else:
response = JsonResponse({'numero': 1, 'ano': datetime.now().year})
return response
class OrigemCrud(Crud):
model = Origem
help_path = 'origem'

19
sapl/norma/migrations/0015_auto_20160929_1635.py

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-09-29 19:35
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('norma', '0014_merge'),
]
operations = [
migrations.AlterModelOptions(
name='legislacaocitada',
options={'verbose_name': 'Legislação', 'verbose_name_plural': 'Legislações'},
),
]

4
sapl/norma/models.py

@ -164,8 +164,8 @@ class LegislacaoCitada(models.Model):
max_length=3, blank=True, verbose_name=_('Item'))
class Meta:
verbose_name = _('Matéria Legislativa')
verbose_name_plural = _('Matérias Legislativas')
verbose_name = _('Legislação')
verbose_name_plural = _('Legislações')
class VinculoNormaJuridica(models.Model):

1
sapl/parlamentares/legacy.yaml

@ -1,4 +1,5 @@
Legislatura:
numero: num_legislatura
data_eleicao: dat_eleicao
data_fim: dat_fim
data_inicio: dat_inicio

25
sapl/templates/materia/materialegislativa_form.html

@ -0,0 +1,25 @@
{% extends "crud/form.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% load common_tags %}
{% block extra_js %}
<script language="Javascript">
function recuperar_numero_ano() {
var tipo = $("#id_tipo").val()
if (tipo) {
$.get("/materia/recuperar-materia",{tipo: tipo},
function(data, status) {
$("#id_numero").val(data.numero);
$("#id_ano").val(data.ano);
console.log(data)
});
}
}
$("#id_tipo").change(recuperar_numero_ano);
</script>
{% endblock %}

14
sapl/templates/materia/relatoria_form.html

@ -0,0 +1,14 @@
{% extends "crud/form.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% load common_tags %}
{% block base_content %}
{% if form.comissao.value == 0 %}
<div class="alert alert-danger alert-dismissible fade in" role="alert">
A localização atual deve ser uma comissão!
</div>
{% else %}
{% crispy form %}
{% endif %}
{% endblock %}
Loading…
Cancel
Save