diff --git a/sapl/base/admin.py b/sapl/base/admin.py index 2f7cd0ed4..88633b0fb 100644 --- a/sapl/base/admin.py +++ b/sapl/base/admin.py @@ -3,35 +3,14 @@ from django.core.urlresolvers import reverse from django.shortcuts import redirect from django.utils.translation import ugettext_lazy as _ from reversion.models import Revision - -from sapl.base.models import ProblemaMigracao from sapl.utils import register_all_models_in_admin register_all_models_in_admin(__name__) -admin.site.unregister(ProblemaMigracao) - admin.site.site_title = 'Administração - SAPL' admin.site.site_header = 'Administração - SAPL' -@admin.register(ProblemaMigracao) -class ProblemaMigracaoAdmin(admin.ModelAdmin): - list_display = ["content_type", "object_id", "nome_campo", "problema", - "descricao", "get_url"] - - def get_url(self, obj): - - info = (obj.content_object._meta.app_label, - obj.content_object._meta.model_name) - endereco = reverse('admin:%s_%s_change' % info, - args=(obj.content_object.pk,)) - return "%s" % (endereco, endereco) - - get_url.short_description = "Endereço" - get_url.allow_tags = True - - class RevisionAdmin(admin.ModelAdmin): list_display = ('user', 'comment', 'date_created') search_fields = ('=user__username', '=user__email') diff --git a/sapl/base/migrations/0016_auto_20180326_1840.py b/sapl/base/migrations/0016_auto_20180326_1840.py new file mode 100644 index 000000000..870b58dc8 --- /dev/null +++ b/sapl/base/migrations/0016_auto_20180326_1840.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.13 on 2018-03-26 21:40 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0015_appconfig_receber_recibo_proposicao'), + ] + + operations = [ + migrations.RemoveField( + model_name='argumento', + name='constraint', + ), + migrations.RemoveField( + model_name='problemamigracao', + name='content_type', + ), + migrations.DeleteModel( + name='Argumento', + ), + migrations.DeleteModel( + name='Constraint', + ), + migrations.DeleteModel( + name='ProblemaMigracao', + ), + ] diff --git a/sapl/base/models.py b/sapl/base/models.py index 3a80e4d7b..d2a6035a8 100644 --- a/sapl/base/models.py +++ b/sapl/base/models.py @@ -5,7 +5,6 @@ from django.db import models from django.db.models.signals import post_migrate from django.db.utils import DEFAULT_DB_ALIAS from django.utils.translation import ugettext_lazy as _ - from sapl.utils import (LISTA_DE_UFS, YES_NO_CHOICES, get_settings_auth_user_model, models_with_gr_for_model) @@ -59,53 +58,6 @@ class CasaLegislativa(models.Model): 'municipio': self.municipio} -@reversion.register() -class ProblemaMigracao(models.Model): - content_type = models.ForeignKey(ContentType, - verbose_name=_('Tipo de Content')) - object_id = models.PositiveIntegerField(verbose_name=_('ID do Objeto')) - content_object = GenericForeignKey('content_type', 'object_id') - nome_campo = models.CharField(max_length=100, - blank=True, - verbose_name=_('Nome do(s) Campo(s)')) - problema = models.CharField(max_length=300, verbose_name=_('Problema')) - descricao = models.CharField(max_length=300, verbose_name=_('Descrição')) - eh_stub = models.BooleanField(verbose_name=_('É stub?')) - critico = models.BooleanField( - default=False, verbose_name=_('Crítico')) - - class Meta: - verbose_name = _('Problema na Migração') - verbose_name_plural = _('Problemas na Migração') - - -@reversion.register() -class Constraint(models.Model): - nome_tabela = models.CharField( - max_length=50, verbose_name=_('Nome da tabela')) - nome_constraint = models.CharField( - max_length=100, verbose_name=_('Nome da constraint')) - nome_model = models.CharField( - max_length=50, verbose_name=_('Nome da model')) - tipo_constraint = models.CharField( - max_length=50, verbose_name=_('Tipo da constraint')) - - class Meta: - verbose_name = _('Constraint removida') - verbose_name_plural = _('Constraints removidas') - - -@reversion.register() -class Argumento(models.Model): - constraint = models.ForeignKey(Constraint) - argumento = models.CharField( - max_length=50, verbose_name=_('Argumento')) - - class Meta: - verbose_name = _('Argumento da constraint') - verbose_name_plural = _('Argumentos da constraint') - - @reversion.register() class AppConfig(models.Model): diff --git a/sapl/legacy/management/commands/recria_constraints.py b/sapl/legacy/management/commands/recria_constraints.py deleted file mode 100644 index d1d8d606d..000000000 --- a/sapl/legacy/management/commands/recria_constraints.py +++ /dev/null @@ -1,10 +0,0 @@ -from django.core.management.base import BaseCommand - - -class Command(BaseCommand): - - help = (u'Recria constraints do PostgreSQL excluidas durante ' - 'migração de dados') - - def handle(self, *args, **options): - pass diff --git a/sapl/legacy/migracao_dados.py b/sapl/legacy/migracao_dados.py index 2ac75c4ef..6aa051e62 100644 --- a/sapl/legacy/migracao_dados.py +++ b/sapl/legacy/migracao_dados.py @@ -21,8 +21,7 @@ from pytz import timezone from unipath import Path from sapl.base.models import AppConfig as AppConf -from sapl.base.models import (Autor, ProblemaMigracao, TipoAutor, - cria_models_tipo_autor) +from sapl.base.models import Autor, TipoAutor, cria_models_tipo_autor from sapl.comissoes.models import Comissao, Composicao, Participacao from sapl.legacy.models import TipoNumeracaoProtocolo from sapl.materia.models import (AcompanhamentoMateria, Proposicao, @@ -564,14 +563,6 @@ def iter_sql_records(sql): yield record -def save_relation(obj, nome_campo='', problema='', descricao='', - eh_stub=False, critico=False): - link = ProblemaMigracao( - content_object=obj, nome_campo=nome_campo, problema=problema, - descricao=descricao, eh_stub=eh_stub, critico=critico) - link.save() - - def fill_vinculo_norma_juridica(): lista = [('A', 'Altera o(a)', 'Alterado(a) pelo(a)'), diff --git a/sapl/rules/map_rules.py b/sapl/rules/map_rules.py index d9d199276..c7589eecf 100644 --- a/sapl/rules/map_rules.py +++ b/sapl/rules/map_rules.py @@ -198,9 +198,6 @@ rules_group_geral = { ]), (base.CasaLegislativa, __listdetailchange__ + [RP_ADD]), - (base.ProblemaMigracao, []), - (base.Argumento, []), - (base.Constraint, []), (base.TipoAutor, __base__), (base.Autor, __base__), diff --git a/sapl/rules/tests/test_rules.py b/sapl/rules/tests/test_rules.py index aa97cb5e5..07302bae5 100644 --- a/sapl/rules/tests/test_rules.py +++ b/sapl/rules/tests/test_rules.py @@ -6,8 +6,7 @@ from django.contrib.contenttypes.models import ContentType from django.utils import six from django.utils.translation import ugettext_lazy as _ -from sapl.base.models import (Argumento, CasaLegislativa, Constraint, - ProblemaMigracao) +from sapl.base.models import CasaLegislativa from sapl.compilacao.models import (PerfilEstruturalTextoArticulado, TipoDispositivo, TipoDispositivoRelationship) @@ -57,41 +56,26 @@ def test_models_in_rules_patterns(model_item): # __falsos_positivos__ __fp__in__test_permission_of_models_in_rules_patterns = { map_rules.RP_ADD: [CasaLegislativa, - ProblemaMigracao, - Argumento, - Constraint, TipoDispositivo, TipoDispositivoRelationship, PerfilEstruturalTextoArticulado], - map_rules.RP_CHANGE: [ProblemaMigracao, - Argumento, - Constraint, - AcompanhamentoMateria, + map_rules.RP_CHANGE: [AcompanhamentoMateria, TipoDispositivo, TipoDispositivoRelationship, PerfilEstruturalTextoArticulado], map_rules.RP_DELETE: [CasaLegislativa, - ProblemaMigracao, - Argumento, - Constraint, TipoDispositivo, TipoDispositivoRelationship, PerfilEstruturalTextoArticulado], - map_rules.RP_LIST: [ProblemaMigracao, - Argumento, - Constraint, - AcompanhamentoMateria, + map_rules.RP_LIST: [AcompanhamentoMateria, TipoDispositivo, TipoDispositivoRelationship, PerfilEstruturalTextoArticulado], - map_rules.RP_DETAIL: [ProblemaMigracao, - Argumento, - Constraint, - AcompanhamentoMateria, + map_rules.RP_DETAIL: [AcompanhamentoMateria, TipoDispositivo, TipoDispositivoRelationship, PerfilEstruturalTextoArticulado]