Browse Source

Merge pull request #379 from interlegis/357-relacoes-reversas-ambiguas

fix #357 Resolver relações reversas ambíguas sem ignorar nenhuma
pull/473/head
Luciano Henrique Nunes de Almeida 9 years ago
parent
commit
c99316b4be
  1. 46
      compilacao/migrations/0050_auto_20160503_0926.py
  2. 13
      compilacao/models.py
  3. 26
      materia/migrations/0032_auto_20160503_0926.py
  4. 6
      materia/models.py
  5. 26
      norma/migrations/0013_auto_20160503_0926.py
  6. 6
      norma/models.py
  7. 26
      protocoloadm/migrations/0012_auto_20160503_0926.py
  8. 4
      protocoloadm/models.py

46
compilacao/migrations/0050_auto_20160503_0926.py

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-03 12:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('compilacao', '0049_merge'),
]
operations = [
migrations.AlterField(
model_name='dispositivo',
name='dispositivo_subsequente',
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dispositivo_subsequente_set', to='compilacao.Dispositivo', verbose_name='Dispositivo Subsequente'),
),
migrations.AlterField(
model_name='dispositivo',
name='dispositivo_substituido',
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dispositivo_substituido_set', to='compilacao.Dispositivo', verbose_name='Dispositivo Substituido'),
),
migrations.AlterField(
model_name='nota',
name='dispositivo',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dispositivo_nota_set', to='compilacao.Dispositivo', verbose_name='Dispositivo da Nota'),
),
migrations.AlterField(
model_name='tipodispositivo',
name='relacoes_diretas_pai_filho',
field=models.ManyToManyField(related_name='relacaoes_pai_filho', through='compilacao.TipoDispositivoRelationship', to='compilacao.TipoDispositivo'),
),
migrations.AlterField(
model_name='vide',
name='dispositivo_base',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dispositivo_base_set', to='compilacao.Dispositivo', verbose_name='Dispositivo Base'),
),
migrations.AlterField(
model_name='vide',
name='dispositivo_ref',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dispositivo_citado_set', to='compilacao.Dispositivo', verbose_name='Dispositivo Referido'),
),
]

13
compilacao/models.py

@ -1,4 +1,3 @@
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
@ -340,7 +339,7 @@ class TipoDispositivo(BaseModel):
through='TipoDispositivoRelationship', through='TipoDispositivoRelationship',
through_fields=('pai', 'filho_permitido'), through_fields=('pai', 'filho_permitido'),
symmetrical=False, symmetrical=False,
related_name='+') related_name='relacaoes_pai_filho')
class Meta: class Meta:
verbose_name = _('Tipo de Dispositivo') verbose_name = _('Tipo de Dispositivo')
@ -608,13 +607,13 @@ class Dispositivo(BaseModel, TimestampedMixin):
dispositivo_subsequente = models.ForeignKey( dispositivo_subsequente = models.ForeignKey(
'self', 'self',
blank=True, null=True, default=None, blank=True, null=True, default=None,
related_name='+', related_name='dispositivo_subsequente_set',
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
verbose_name=_('Dispositivo Subsequente')) verbose_name=_('Dispositivo Subsequente'))
dispositivo_substituido = models.ForeignKey( dispositivo_substituido = models.ForeignKey(
'self', 'self',
blank=True, null=True, default=None, blank=True, null=True, default=None,
related_name='+', related_name='dispositivo_substituido_set',
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
verbose_name=_('Dispositivo Substituido')) verbose_name=_('Dispositivo Substituido'))
dispositivo_pai = models.ForeignKey( dispositivo_pai = models.ForeignKey(
@ -1213,10 +1212,10 @@ class Vide(TimestampedMixin):
dispositivo_base = models.ForeignKey( dispositivo_base = models.ForeignKey(
Dispositivo, Dispositivo,
verbose_name=_('Dispositivo Base'), verbose_name=_('Dispositivo Base'),
related_name='cita') related_name='dispositivo_base_set')
dispositivo_ref = models.ForeignKey( dispositivo_ref = models.ForeignKey(
Dispositivo, Dispositivo,
related_name='citado', related_name='dispositivo_citado_set',
verbose_name=_('Dispositivo Referido')) verbose_name=_('Dispositivo Referido'))
class Meta: class Meta:
@ -1265,7 +1264,7 @@ class Nota(TimestampedMixin):
dispositivo = models.ForeignKey( dispositivo = models.ForeignKey(
Dispositivo, Dispositivo,
verbose_name=_('Dispositivo da Nota'), verbose_name=_('Dispositivo da Nota'),
related_name='notas') related_name='dispositivo_nota_set')
owner = models.ForeignKey(User, verbose_name=_('Dono da Nota')) owner = models.ForeignKey(User, verbose_name=_('Dono da Nota'))
publicidade = models.PositiveSmallIntegerField( publicidade = models.PositiveSmallIntegerField(

26
materia/migrations/0032_auto_20160503_0926.py

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-03 12:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('materia', '0031_merge'),
]
operations = [
migrations.AlterField(
model_name='anexada',
name='materia_anexada',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materia_anexada_set', to='materia.MateriaLegislativa'),
),
migrations.AlterField(
model_name='anexada',
name='materia_principal',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materia_principal_set', to='materia.MateriaLegislativa'),
),
]

6
materia/models.py

@ -156,8 +156,10 @@ class AcompanhamentoMateria(models.Model):
class Anexada(models.Model): class Anexada(models.Model):
materia_principal = models.ForeignKey(MateriaLegislativa, related_name='+') materia_principal = models.ForeignKey(
materia_anexada = models.ForeignKey(MateriaLegislativa, related_name='+') MateriaLegislativa, related_name='materia_principal_set')
materia_anexada = models.ForeignKey(
MateriaLegislativa, related_name='materia_anexada_set')
data_anexacao = models.DateField(verbose_name=_('Data Anexação')) data_anexacao = models.DateField(verbose_name=_('Data Anexação'))
data_desanexacao = models.DateField( data_desanexacao = models.DateField(
blank=True, null=True, verbose_name=_('Data Desanexação')) blank=True, null=True, verbose_name=_('Data Desanexação'))

26
norma/migrations/0013_auto_20160503_0926.py

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-03 12:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('norma', '0012_auto_20160309_1407'),
]
operations = [
migrations.AlterField(
model_name='vinculonormajuridica',
name='norma_referente',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='norma_referente_set', to='norma.NormaJuridica'),
),
migrations.AlterField(
model_name='vinculonormajuridica',
name='norma_referida',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='norma_referida_set', to='norma.NormaJuridica'),
),
]

6
norma/models.py

@ -175,8 +175,10 @@ class VinculoNormaJuridica(models.Model):
) )
# TODO M2M ??? # TODO M2M ???
norma_referente = models.ForeignKey(NormaJuridica, related_name='+') norma_referente = models.ForeignKey(
norma_referida = models.ForeignKey(NormaJuridica, related_name='+') NormaJuridica, related_name='norma_referente_set')
norma_referida = models.ForeignKey(
NormaJuridica, related_name='norma_referida_set')
tipo_vinculo = models.CharField( tipo_vinculo = models.CharField(
max_length=1, blank=True, choices=TIPO_VINCULO_CHOICES) max_length=1, blank=True, choices=TIPO_VINCULO_CHOICES)

26
protocoloadm/migrations/0012_auto_20160503_0926.py

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-03 12:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0011_auto_20160318_1504'),
]
operations = [
migrations.AlterField(
model_name='tramitacaoadministrativo',
name='unidade_tramitacao_destino',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='adm_tramitacoes_destino', to='materia.UnidadeTramitacao', verbose_name='Unidade Destino'),
),
migrations.AlterField(
model_name='tramitacaoadministrativo',
name='unidade_tramitacao_local',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='adm_tramitacoes_origem', to='materia.UnidadeTramitacao', verbose_name='Unidade Local'),
),
]

4
protocoloadm/models.py

@ -165,7 +165,7 @@ class TramitacaoAdministrativo(models.Model):
UnidadeTramitacao, UnidadeTramitacao,
blank=True, blank=True,
null=True, null=True,
related_name='+', related_name='adm_tramitacoes_origem',
verbose_name=_('Unidade Local')) verbose_name=_('Unidade Local'))
data_encaminhamento = models.DateField( data_encaminhamento = models.DateField(
blank=True, null=True, verbose_name=_('Data Encaminhamento')) blank=True, null=True, verbose_name=_('Data Encaminhamento'))
@ -173,7 +173,7 @@ class TramitacaoAdministrativo(models.Model):
UnidadeTramitacao, UnidadeTramitacao,
blank=True, blank=True,
null=True, null=True,
related_name='+', related_name='adm_tramitacoes_destino',
verbose_name=_('Unidade Destino')) verbose_name=_('Unidade Destino'))
ultima = models.BooleanField() ultima = models.BooleanField()
texto = models.TextField( texto = models.TextField(

Loading…
Cancel
Save