|
|
@ -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', |
|
|
|
) |
|
|
|