Browse Source

Concerta alguns problemas de model e admin

Signed-off-by: Luciano Almeida <lucianoalmeida@interlegis.leg.br>
pull/329/head
Luciano Almeida 9 years ago
parent
commit
7c97c32469
  1. 9
      base/admin.py
  2. 27
      base/migrations/0014_auto_20160502_1635.py
  3. 7
      base/models.py
  4. 2
      legacy/migration.py
  5. 21
      materia/migrations/0030_auto_20160502_1630.py

9
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 "<a href='%s'>%s</a>" % (endereco, endereco)
get_url.short_description = "Endereço"

27
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,
),
]

7
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:

2
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

21
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'),
),
]
Loading…
Cancel
Save