Fix Django 2.0 deprecation warnings

This commit is contained in:
AlanCoding
2019-04-12 14:45:44 -04:00
parent 864fef4f29
commit 8c2b3e9b84
15 changed files with 24 additions and 17 deletions

View File

@@ -249,6 +249,7 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique, ResourceMixin):
'CredentialType',
related_name='credentials',
null=False,
on_delete=models.CASCADE,
help_text=_('Specify the type of credential you want to create. Refer '
'to the Ansible Tower documentation for details on each type.')
)

View File

@@ -172,7 +172,8 @@ class InstanceGroup(HasPolicyEditsMixin, BaseModel, RelatedJobsMixin):
help_text=_('Instance Group to remotely control this group.'),
editable=False,
default=None,
null=True
null=True,
on_delete=models.CASCADE
)
policy_instance_percentage = models.IntegerField(
default=0,
@@ -264,8 +265,8 @@ class JobOrigin(models.Model):
This is fine, and code should be able to handle it. A job with no origin
is always assumed to *not* have the current instance as its origin.
"""
unified_job = models.OneToOneField(UnifiedJob, related_name='job_origin')
instance = models.ForeignKey(Instance)
unified_job = models.OneToOneField(UnifiedJob, related_name='job_origin', on_delete=models.CASCADE)
instance = models.ForeignKey(Instance, on_delete=models.CASCADE)
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)

View File

@@ -147,6 +147,7 @@ class Profile(CreatedModifiedModel):
'auth.User',
related_name='profile',
editable=False,
on_delete=models.CASCADE
)
ldap_dn = models.CharField(
max_length=1024,

View File

@@ -150,7 +150,7 @@ class Role(models.Model):
related_name='descendents'
) # auto-generated by `rebuild_role_ancestor_list`
members = models.ManyToManyField('auth.User', related_name='roles')
content_type = models.ForeignKey(ContentType, null=True, default=None)
content_type = models.ForeignKey(ContentType, null=True, default=None, on_delete=models.CASCADE)
object_id = models.PositiveIntegerField(null=True, default=None)
content_object = GenericForeignKey('content_type', 'object_id')