From 2e2112b60c0e799a63d145cbbf1251c2d641a940 Mon Sep 17 00:00:00 2001 From: LeandroRoberto Date: Mon, 3 Apr 2017 11:25:46 -0300 Subject: [PATCH] Corrige url_tag e campo em model DocumentoAcessorio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No Sapl 2.5, a tabela documento_acessorio, campo nom_documento possui tamanho 50 e não 30. Em testes de migração em minha base ocorreram erros devido a diferença. Veja aqui o sql de instalação 2.5 https://colab.interlegis.leg.br/browser/publico/ILSAPL/trunk/instalacao/sapl.sql#L469. --- .../migrations/0002_auto_20170330_1513.py | 20 +++++++++++++++++++ sapl/materia/models.py | 5 +++-- sapl/norma/urls.py | 2 +- .../norma/normarelacionada_form.html | 2 +- 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 sapl/materia/migrations/0002_auto_20170330_1513.py diff --git a/sapl/materia/migrations/0002_auto_20170330_1513.py b/sapl/materia/migrations/0002_auto_20170330_1513.py new file mode 100644 index 000000000..72345fc62 --- /dev/null +++ b/sapl/materia/migrations/0002_auto_20170330_1513.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.12 on 2017-03-30 15:13 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('materia', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='documentoacessorio', + name='nome', + field=models.CharField(max_length=50, verbose_name='Nome'), + ), + ] diff --git a/sapl/materia/models.py b/sapl/materia/models.py index 372efadf0..2f3ee70c3 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -1,6 +1,5 @@ from datetime import datetime -import reversion from django.contrib.auth.models import Group from django.contrib.contenttypes.fields import GenericRelation from django.contrib.contenttypes.models import ContentType @@ -8,6 +7,7 @@ from django.db import models from django.utils import formats from django.utils.translation import ugettext_lazy as _ from model_utils import Choices +import reversion from sapl.base.models import Autor from sapl.comissoes.models import Comissao @@ -18,6 +18,7 @@ from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, SaplGenericForeignKey, SaplGenericRelation, restringe_tipos_de_arquivo_txt, texto_upload_path) + EM_TRAMITACAO = [(1, 'Sim'), (0, 'Não')] @@ -361,7 +362,7 @@ class DocumentoAcessorio(models.Model): tipo = models.ForeignKey(TipoDocumento, on_delete=models.PROTECT, verbose_name=_('Tipo')) - nome = models.CharField(max_length=30, verbose_name=_('Nome')) + nome = models.CharField(max_length=50, verbose_name=_('Nome')) data = models.DateField(blank=True, null=True, verbose_name=_('Data')) autor = models.CharField( max_length=50, blank=True, verbose_name=_('Autor')) diff --git a/sapl/norma/urls.py b/sapl/norma/urls.py index 4d434d42b..abf13c276 100644 --- a/sapl/norma/urls.py +++ b/sapl/norma/urls.py @@ -24,6 +24,6 @@ urlpatterns = [ url(r'^norma/pesquisar$', NormaPesquisaView.as_view(), name='norma_pesquisa'), - url(r'^norma/recuperar-norma/', recuperar_norma), + url(r'^norma/recuperar-norma$', recuperar_norma, name="recuperar_norma"), ] diff --git a/sapl/templates/norma/normarelacionada_form.html b/sapl/templates/norma/normarelacionada_form.html index 300f7e3b3..7fbd03c45 100644 --- a/sapl/templates/norma/normarelacionada_form.html +++ b/sapl/templates/norma/normarelacionada_form.html @@ -11,7 +11,7 @@ var ano = $("#id_ano").val() if (tipo && numero && ano) { - $.get("/norma/recuperar-norma",{tipo: tipo, + $.get("{% url 'sapl.norma:recuperar_norma' %}",{tipo: tipo, numero: numero, ano: ano}, function(data, status) {