diff --git a/base/admin.py b/base/admin.py index 37e400946..99f81f8af 100644 --- a/base/admin.py +++ b/base/admin.py @@ -1,8 +1,8 @@ from django.contrib import admin +from django.core.urlresolvers import reverse from base.models import ProblemaMigracao from sapl.utils import register_all_models_in_admin -from django.core.urlresolvers import reverse register_all_models_in_admin(__name__) @@ -15,8 +15,11 @@ class ProblemaMigracaoAdmin(admin.ModelAdmin): "descricao", "get_url"] def get_url(self, obj): - info = (obj._meta.app_label, obj._meta.model_name) - endereco = reverse('admin:%s_%s_change' % info, args=(obj.pk,)) + + 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" diff --git a/base/migrations/0014_auto_20160502_1635.py b/base/migrations/0014_auto_20160502_1635.py new file mode 100644 index 000000000..6fbae0bb9 --- /dev/null +++ b/base/migrations/0014_auto_20160502_1635.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-05-02 19:35 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0013_remove_problemamigracao_endereco'), + ] + + operations = [ + migrations.AlterField( + model_name='problemamigracao', + name='descricao', + field=models.CharField(default='', max_length=300, verbose_name='Descrição'), + preserve_default=False, + ), + migrations.AlterField( + model_name='problemamigracao', + name='problema', + field=models.CharField(default='', max_length=300, verbose_name='Problema'), + preserve_default=False, + ), + ] diff --git a/base/models.py b/base/models.py index 9a94c9eb8..f1fb3811f 100644 --- a/base/models.py +++ b/base/models.py @@ -2,6 +2,7 @@ from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models from django.utils.translation import ugettext_lazy as _ + from sapl.utils import UF @@ -53,10 +54,8 @@ class ProblemaMigracao(models.Model): verbose_name=_('Tipo de Content')) object_id = models.PositiveIntegerField(verbose_name=_('ID do Objeto')) content_object = GenericForeignKey('content_type', 'object_id') - problema = models.CharField(max_length=300, null=True, - verbose_name=_('Problema')) - descricao = models.CharField(max_length=300, null=True, - verbose_name=_('Descrição')) + 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?') class Meta: diff --git a/legacy/migration.py b/legacy/migration.py index d69da781c..ddc8e0bfd 100644 --- a/legacy/migration.py +++ b/legacy/migration.py @@ -5,7 +5,6 @@ import yaml from django.apps import apps from django.apps.config import AppConfig from django.core.exceptions import ObjectDoesNotExist -from django.core.urlresolvers import reverse from django.db import connections, models from django.db.models import CharField, TextField from django.db.models.base import ModelBase @@ -14,7 +13,6 @@ from model_mommy.mommy import foreign_key_required, make from base.models import ProblemaMigracao from comissoes.models import Composicao, Participacao -from materia.models import TipoMateriaLegislativa from parlamentares.models import Parlamentar from sessao.models import SessaoPlenaria diff --git a/materia/migrations/0030_auto_20160502_1630.py b/materia/migrations/0030_auto_20160502_1630.py new file mode 100644 index 000000000..6f8fd60be --- /dev/null +++ b/materia/migrations/0030_auto_20160502_1630.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-05-02 19:30 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('materia', '0029_merge'), + ] + + operations = [ + migrations.AlterField( + model_name='materialegislativa', + name='tipo_origem_externa', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tipo_origem_externa_set', to='materia.TipoMateriaLegislativa', verbose_name='Tipo'), + ), + ]