Browse Source

Remove unique_together de TipoProposicao

pull/1464/head
Marcio Mazza 7 years ago
parent
commit
4776d4a514
  1. 37
      sapl/materia/migrations/0015_auto_20170908_1024.py
  2. 1
      sapl/materia/models.py

37
sapl/materia/migrations/0015_auto_20170908_1024.py

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-09-08 10:24
from __future__ import unicode_literals
from django.db import migrations
from sapl.materia.models import TipoProposicao
class AlterUniqueTogetherFixConstraintInexistente(
migrations.AlterUniqueTogether):
def database_forwards(self,
app_label, schema_editor, from_state, to_state):
constraint_names = schema_editor._constraint_names(
TipoProposicao, ['content_type_id', 'object_id'], unique=True)
if constraint_names:
# por alguma razão a constraint não existe em alguns bancos
# se ela existir continua a exetução normal
super(AlterUniqueTogetherFixConstraintInexistente,
self).database_forwards(
app_label, schema_editor, from_state, to_state
)
class Migration(migrations.Migration):
dependencies = [
('materia', '0014_auto_20170905_0818'),
]
operations = [
AlterUniqueTogetherFixConstraintInexistente(
name='tipoproposicao',
unique_together=set([]),
),
]

1
sapl/materia/models.py

@ -66,7 +66,6 @@ class TipoProposicao(models.Model):
class Meta:
verbose_name = _('Tipo de Proposição')
verbose_name_plural = _('Tipos de Proposições')
unique_together = (('content_type', 'object_id'), )
def __str__(self):
return self.descricao

Loading…
Cancel
Save