|
@@ -111,13 +111,13 @@ class Contact(PrimaryModel):
|
|
|
|
|
|
|
|
|
|
|
|
|
class ContactAssignment(CustomFieldsMixin, ExportTemplatesMixin, TagsMixin, ChangeLoggedModel):
|
|
class ContactAssignment(CustomFieldsMixin, ExportTemplatesMixin, TagsMixin, ChangeLoggedModel):
|
|
|
- content_type = models.ForeignKey(
|
|
|
|
|
|
|
+ object_type = models.ForeignKey(
|
|
|
to='contenttypes.ContentType',
|
|
to='contenttypes.ContentType',
|
|
|
on_delete=models.CASCADE
|
|
on_delete=models.CASCADE
|
|
|
)
|
|
)
|
|
|
object_id = models.PositiveBigIntegerField()
|
|
object_id = models.PositiveBigIntegerField()
|
|
|
object = GenericForeignKey(
|
|
object = GenericForeignKey(
|
|
|
- ct_field='content_type',
|
|
|
|
|
|
|
+ ct_field='object_type',
|
|
|
fk_field='object_id'
|
|
fk_field='object_id'
|
|
|
)
|
|
)
|
|
|
contact = models.ForeignKey(
|
|
contact = models.ForeignKey(
|
|
@@ -137,16 +137,16 @@ class ContactAssignment(CustomFieldsMixin, ExportTemplatesMixin, TagsMixin, Chan
|
|
|
blank=True
|
|
blank=True
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- clone_fields = ('content_type', 'object_id', 'role', 'priority')
|
|
|
|
|
|
|
+ clone_fields = ('object_type', 'object_id', 'role', 'priority')
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
ordering = ('contact', 'priority', 'role', 'pk')
|
|
ordering = ('contact', 'priority', 'role', 'pk')
|
|
|
indexes = (
|
|
indexes = (
|
|
|
- models.Index(fields=('content_type', 'object_id')),
|
|
|
|
|
|
|
+ models.Index(fields=('object_type', 'object_id')),
|
|
|
)
|
|
)
|
|
|
constraints = (
|
|
constraints = (
|
|
|
models.UniqueConstraint(
|
|
models.UniqueConstraint(
|
|
|
- fields=('content_type', 'object_id', 'contact', 'role'),
|
|
|
|
|
|
|
+ fields=('object_type', 'object_id', 'contact', 'role'),
|
|
|
name='%(app_label)s_%(class)s_unique_object_contact_role'
|
|
name='%(app_label)s_%(class)s_unique_object_contact_role'
|
|
|
),
|
|
),
|
|
|
)
|
|
)
|
|
@@ -165,9 +165,9 @@ class ContactAssignment(CustomFieldsMixin, ExportTemplatesMixin, TagsMixin, Chan
|
|
|
super().clean()
|
|
super().clean()
|
|
|
|
|
|
|
|
# Validate the assigned object type
|
|
# Validate the assigned object type
|
|
|
- if self.content_type not in ObjectType.objects.with_feature('contacts'):
|
|
|
|
|
|
|
+ if self.object_type not in ObjectType.objects.with_feature('contacts'):
|
|
|
raise ValidationError(
|
|
raise ValidationError(
|
|
|
- _("Contacts cannot be assigned to this object type ({type}).").format(type=self.content_type)
|
|
|
|
|
|
|
+ _("Contacts cannot be assigned to this object type ({type}).").format(type=self.object_type)
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
def to_objectchange(self, action):
|
|
def to_objectchange(self, action):
|