diff --git a/sigi/apps/casas/models.py b/sigi/apps/casas/models.py index 1ca27b7..f1554a9 100644 --- a/sigi/apps/casas/models.py +++ b/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 diff --git a/sigi/apps/contatos/models.py b/sigi/apps/contatos/models.py index 155d978..79bf0ca 100644 --- a/sigi/apps/contatos/models.py +++ b/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', ) diff --git a/sigi/apps/inventario/models.py b/sigi/apps/inventario/models.py index 24ecf6e..10a6bd2 100644 --- a/sigi/apps/inventario/models.py +++ b/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',) diff --git a/sigi/apps/servidores/models.py b/sigi/apps/servidores/models.py index 3a05411..0bae16c 100644 --- a/sigi/apps/servidores/models.py +++ b/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 _