From 509892bebca399a7167770d9e62dde9f512cfd8b Mon Sep 17 00:00:00 2001 From: Thomas NOEL Date: Mon, 16 May 2016 15:22:39 +0200 Subject: [PATCH] use new Django contenttypes.fields (#10943) --- welco/qualif/models.py | 4 ++-- welco/sources/counter/models.py | 4 ++-- welco/sources/mail/models.py | 4 ++-- welco/sources/phone/models.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/welco/qualif/models.py b/welco/qualif/models.py index 200ae48..829abd3 100644 --- a/welco/qualif/models.py +++ b/welco/qualif/models.py @@ -15,7 +15,7 @@ # along with this program. If not, see . from django.contrib.contenttypes.models import ContentType -from django.contrib.contenttypes import generic +from django.contrib.contenttypes.fields import GenericForeignKey from django.core.urlresolvers import reverse from django.db import models from django.utils.translation import ugettext_lazy as _ @@ -26,7 +26,7 @@ from welco.utils import get_wcs_formdef_details, push_wcs_formdata, get_wcs_serv class Association(models.Model): source_type = models.ForeignKey(ContentType) source_pk = models.PositiveIntegerField() - source = generic.GenericForeignKey('source_type', 'source_pk') + source = GenericForeignKey('source_type', 'source_pk') comments = models.TextField(blank=True, verbose_name=_('Comments')) formdef_reference = models.CharField(max_length=250, null=True) formdata_id = models.CharField(max_length=250, null=True) diff --git a/welco/sources/counter/models.py b/welco/sources/counter/models.py index 0cd312a..10b956c 100644 --- a/welco/sources/counter/models.py +++ b/welco/sources/counter/models.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from django.contrib.contenttypes import generic +from django.contrib.contenttypes.fields import GenericRelation from django.db import models from django.utils.translation import ugettext_lazy as _ @@ -28,7 +28,7 @@ class CounterPresence(models.Model): # common to all source types: status = models.CharField(_('Status'), blank=True, max_length=50) contact_id = models.CharField(max_length=50, null=True) - associations = generic.GenericRelation(Association, + associations = GenericRelation(Association, content_type_field='source_type', object_id_field='source_pk') creation_timestamp = models.DateTimeField(auto_now_add=True) diff --git a/welco/sources/mail/models.py b/welco/sources/mail/models.py index 6d91fe9..84ae30e 100644 --- a/welco/sources/mail/models.py +++ b/welco/sources/mail/models.py @@ -17,7 +17,7 @@ import re import subprocess -from django.contrib.contenttypes import generic +from django.contrib.contenttypes.fields import GenericRelation from django.contrib.contenttypes.models import ContentType from django.core.urlresolvers import reverse from django.db import models @@ -45,7 +45,7 @@ class Mail(models.Model): # common to all source types: status = models.CharField(_('Status'), blank=True, max_length=50) contact_id = models.CharField(max_length=50, null=True) - associations = generic.GenericRelation(Association, + associations = GenericRelation(Association, content_type_field='source_type', object_id_field='source_pk') creation_timestamp = models.DateTimeField(auto_now_add=True) diff --git a/welco/sources/phone/models.py b/welco/sources/phone/models.py index 4ea4f4b..d02b154 100644 --- a/welco/sources/phone/models.py +++ b/welco/sources/phone/models.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from django.contrib.contenttypes import generic +from django.contrib.contenttypes.fields import GenericRelation from django.core.urlresolvers import reverse from django.db import models from django.utils.translation import ugettext_lazy as _ @@ -35,7 +35,7 @@ class PhoneCall(models.Model): # common to all source types: status = models.CharField(_('Status'), blank=True, max_length=50) contact_id = models.CharField(max_length=50, null=True) - associations = generic.GenericRelation(Association, + associations = GenericRelation(Association, content_type_field='source_type', object_id_field='source_pk') creation_timestamp = models.DateTimeField(auto_now_add=True) -- 2.8.1