summaryrefslogtreecommitdiff
path: root/tests/foreign_object
diff options
context:
space:
mode:
authorNick Pope <nick.pope@flightdataservices.com>2019-08-20 08:54:41 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-02-04 13:20:06 +0100
commit335c9c94acf263901fb023404408880245b0c4b4 (patch)
tree691e9683de6c9840cd0a9a097d020c499ea735db /tests/foreign_object
parent469bf2db15597f2c87cb0f8f64132056d2467f15 (diff)
downloaddjango-335c9c94acf263901fb023404408880245b0c4b4.tar.gz
Simplified imports from django.db and django.contrib.gis.db.
Diffstat (limited to 'tests/foreign_object')
-rw-r--r--tests/foreign_object/models/customers.py5
-rw-r--r--tests/foreign_object/models/empty_join.py6
-rw-r--r--tests/foreign_object/tests.py5
3 files changed, 6 insertions, 10 deletions
diff --git a/tests/foreign_object/models/customers.py b/tests/foreign_object/models/customers.py
index 24c080f407..7e1a3ac370 100644
--- a/tests/foreign_object/models/customers.py
+++ b/tests/foreign_object/models/customers.py
@@ -1,5 +1,4 @@
from django.db import models
-from django.db.models.fields.related import ForeignObject
class Address(models.Model):
@@ -15,7 +14,7 @@ class Address(models.Model):
class Customer(models.Model):
company = models.CharField(max_length=1)
customer_id = models.IntegerField()
- address = ForeignObject(
+ address = models.ForeignObject(
Address, models.CASCADE, null=True,
# order mismatches the Contact ForeignObject.
from_fields=['company', 'customer_id'],
@@ -31,7 +30,7 @@ class Customer(models.Model):
class Contact(models.Model):
company_code = models.CharField(max_length=1)
customer_code = models.IntegerField()
- customer = ForeignObject(
+ customer = models.ForeignObject(
Customer, models.CASCADE, related_name='contacts',
to_fields=['customer_id', 'company'],
from_fields=['customer_code', 'company_code'],
diff --git a/tests/foreign_object/models/empty_join.py b/tests/foreign_object/models/empty_join.py
index 08d1edb18a..8ccecc55cb 100644
--- a/tests/foreign_object/models/empty_join.py
+++ b/tests/foreign_object/models/empty_join.py
@@ -1,12 +1,10 @@
from django.db import models
-from django.db.models.fields.related import (
- ForeignObjectRel, ReverseManyToOneDescriptor,
-)
+from django.db.models.fields.related import ReverseManyToOneDescriptor
from django.db.models.lookups import StartsWith
from django.db.models.query_utils import PathInfo
-class CustomForeignObjectRel(ForeignObjectRel):
+class CustomForeignObjectRel(models.ForeignObjectRel):
"""
Define some extra Field methods so this Rel acts more like a Field, which
lets us use ReverseManyToOneDescriptor in both directions.
diff --git a/tests/foreign_object/tests.py b/tests/foreign_object/tests.py
index 7fed5557eb..b211c6e328 100644
--- a/tests/foreign_object/tests.py
+++ b/tests/foreign_object/tests.py
@@ -3,7 +3,6 @@ from operator import attrgetter
from django.core.exceptions import FieldError
from django.db import models
-from django.db.models.fields.related import ForeignObject
from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
from django.test.utils import isolate_apps
from django.utils import translation
@@ -436,7 +435,7 @@ class TestModelCheckTests(SimpleTestCase):
a = models.PositiveIntegerField()
b = models.PositiveIntegerField()
value = models.CharField(max_length=255)
- parent = ForeignObject(
+ parent = models.ForeignObject(
Parent,
on_delete=models.SET_NULL,
from_fields=('a', 'b'),
@@ -461,7 +460,7 @@ class TestModelCheckTests(SimpleTestCase):
b = models.PositiveIntegerField()
c = models.PositiveIntegerField()
d = models.CharField(max_length=255)
- parent = ForeignObject(
+ parent = models.ForeignObject(
Parent,
on_delete=models.SET_NULL,
from_fields=('a', 'b', 'c'),