Browse Source

Corrigindo Generic Relation fields que foram movidos

revisaoSidenav
Sesostris Vieira 3 years ago
parent
commit
24dc12233d
  1. 8
      sigi/apps/casas/models.py
  2. 11
      sigi/apps/contatos/models.py
  3. 6
      sigi/apps/inventario/models.py
  4. 1
      sigi/apps/servidores/models.py

8
sigi/apps/casas/models.py

@ -5,7 +5,7 @@ from string import ascii_uppercase
from unicodedata import normalize
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from image_cropping import ImageRatioField
@ -132,7 +132,7 @@ class Orgao(models.Model):
blank=True,
editable=True
)
telefones = generic.GenericRelation('contatos.Telefone')
telefones = GenericRelation('contatos.Telefone')
foto = models.ImageField(
_(u"Foto"),
@ -194,8 +194,8 @@ class Orgao(models.Model):
return self.funcionario_set.get(setor='presidente')
except Funcionario.DoesNotExist:
return None
@property
@property
def contato_interlegis(self):
""" Link para acessar diretamente o contato do presidente da casa
Util para relatorios antigos

11
sigi/apps/contatos/models.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.fields import (GenericForeignKey,
GenericRelation)
from django.contrib.contenttypes.models import ContentType
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
@ -193,7 +194,7 @@ class Telefone(models.Model):
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
# identificador do registro na classe vinculado a esse registro
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey(
content_object = GenericForeignKey(
'content_type',
'object_id',
)
@ -216,7 +217,7 @@ class Contato(models.Model):
nota = models.CharField(max_length=70, blank=True)
email = models.EmailField(_(u'e-mail'), blank=True)
telefones = generic.GenericRelation(Telefone)
telefones = GenericRelation(Telefone)
municipio = models.ForeignKey(
Municipio,
@ -230,7 +231,7 @@ class Contato(models.Model):
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
# identificador do registro na classe vinculado a esse registro
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey(
content_object = GenericForeignKey(
'content_type',
'object_id',
)
@ -326,7 +327,7 @@ class Endereco(models.Model):
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
# identificador do registro na classe vinculado a esse registro
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey(
content_object = GenericForeignKey(
'content_type',
'object_id',
)

6
sigi/apps/inventario/models.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from django.utils.translation import ugettext as _
@ -9,8 +9,8 @@ class Fornecedor(models.Model):
nome.alphabetic_filter = True
email = models.EmailField(_(u'e-mail'), blank=True)
pagina_web = models.URLField(_(u'página web'), blank=True)
telefones = generic.GenericRelation('contatos.Telefone')
contatos = generic.GenericRelation('contatos.Contato')
telefones = GenericRelation('contatos.Telefone')
contatos = GenericRelation('contatos.Contato')
class Meta:
ordering = ('nome',)

1
sigi/apps/servidores/models.py

@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.db import models
from django.db.models.signals import post_save, pre_save
from django.utils.translation import ugettext as _

Loading…
Cancel
Save