use new Django contenttypes.fields (#10943)
This commit is contained in:
parent
1c23fd389b
commit
3b3c9dc111
|
@ -15,7 +15,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue