mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 06:51:10 +03:00
Merge pull request #3696 from AlanCoding/django2_warnings
Fix Django 2.0 deprecation warnings Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
commit
2cb6104fe4
@ -4,4 +4,7 @@
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
from .urls import urlpatterns
|
||||
|
||||
__all__ = ['urlpatterns']
|
||||
__all__ = ['urlpatterns', 'app_name']
|
||||
|
||||
|
||||
app_name = 'api'
|
||||
|
@ -2,7 +2,7 @@
|
||||
# All Rights Reserved.
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import NoReverseMatch
|
||||
from django.urls import NoReverseMatch
|
||||
|
||||
from rest_framework.reverse import _reverse
|
||||
from rest_framework.versioning import URLPathVersioning as BaseVersioning
|
||||
|
@ -2,7 +2,7 @@ import urllib.parse
|
||||
|
||||
import pytest
|
||||
|
||||
from django.core.urlresolvers import resolve
|
||||
from django.urls import resolve
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from rest_framework.test import (
|
||||
|
@ -18,7 +18,7 @@ from django.db.models.signals import (
|
||||
)
|
||||
from django.db.models.signals import m2m_changed
|
||||
from django.db import models
|
||||
from django.db.models.fields.related import add_lazy_relation
|
||||
from django.db.models.fields.related import lazy_related_operation
|
||||
from django.db.models.fields.related_descriptors import (
|
||||
ReverseOneToOneDescriptor,
|
||||
ForwardManyToOneDescriptor,
|
||||
@ -227,6 +227,7 @@ class ImplicitRoleField(models.ForeignKey):
|
||||
kwargs.setdefault('related_name', '+')
|
||||
kwargs.setdefault('null', 'True')
|
||||
kwargs.setdefault('editable', False)
|
||||
kwargs.setdefault('on_delete', models.CASCADE)
|
||||
super(ImplicitRoleField, self).__init__(*args, **kwargs)
|
||||
|
||||
def deconstruct(self):
|
||||
@ -244,7 +245,9 @@ class ImplicitRoleField(models.ForeignKey):
|
||||
|
||||
post_save.connect(self._post_save, cls, True, dispatch_uid='implicit-role-post-save')
|
||||
post_delete.connect(self._post_delete, cls, True, dispatch_uid='implicit-role-post-delete')
|
||||
add_lazy_relation(cls, self, "self", self.bind_m2m_changed)
|
||||
|
||||
function = lambda local, related, field: self.bind_m2m_changed(field, related, local)
|
||||
lazy_related_operation(function, cls, "self", field=self)
|
||||
|
||||
def bind_m2m_changed(self, _self, _role_class, cls):
|
||||
if not self.parent_role:
|
||||
|
@ -19,8 +19,7 @@ from django.utils.functional import curry
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.apps import apps
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import resolve
|
||||
from django.urls import reverse, resolve
|
||||
|
||||
from awx.main.models import ActivityStream
|
||||
from awx.main.utils.named_url_graph import generate_graph, GraphNode
|
||||
|
@ -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.')
|
||||
)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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')
|
||||
|
||||
|
@ -7,7 +7,7 @@ import urllib.parse
|
||||
from unittest.mock import PropertyMock
|
||||
|
||||
# Django
|
||||
from django.core.urlresolvers import resolve
|
||||
from django.urls import resolve
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
from django.db.backends.sqlite3.base import SQLiteCursorWrapper
|
||||
|
@ -6,7 +6,7 @@ from unittest.mock import PropertyMock
|
||||
from awx.api.urls import urlpatterns as api_patterns
|
||||
|
||||
# Django
|
||||
from django.core.urlresolvers import RegexURLResolver, RegexURLPattern
|
||||
from django.urls import RegexURLResolver, RegexURLPattern
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
@ -455,7 +455,6 @@ except ImportError:
|
||||
pass
|
||||
|
||||
DEBUG_TOOLBAR_CONFIG = {
|
||||
'INTERCEPT_REDIRECTS': False,
|
||||
'ENABLE_STACKTRACES' : True,
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import urllib.parse as urlparse
|
||||
|
||||
# Django
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
# Django REST Framework
|
||||
|
@ -6,7 +6,7 @@ import urllib.parse
|
||||
import logging
|
||||
|
||||
# Django
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
from django.http import HttpResponse
|
||||
from django.views.generic import View
|
||||
from django.views.generic.base import RedirectView
|
||||
|
@ -1,4 +1,4 @@
|
||||
django-debug-toolbar==1.5
|
||||
django-debug-toolbar==1.11
|
||||
django-rest-swagger
|
||||
pprofile
|
||||
ipython==5.2.1
|
||||
|
Loading…
Reference in New Issue
Block a user