Refactor in join in order to make possibility for nested duplicated relations (and it was a mess :D)
This commit is contained in:
@ -190,7 +190,7 @@ async def test_m2m_self_forwardref_relation(cleanup):
|
||||
# await steve.friends.add(billy)
|
||||
|
||||
billy_check = await Child.objects.select_related(
|
||||
["friends", "favourite_game", "least_favourite_game",]
|
||||
["friends", "favourite_game", "least_favourite_game"]
|
||||
).get(name="Billy")
|
||||
assert len(billy_check.friends) == 2
|
||||
assert billy_check.friends[0].name == "Kate"
|
||||
@ -200,5 +200,6 @@ async def test_m2m_self_forwardref_relation(cleanup):
|
||||
kate_check = await Child.objects.select_related(["also_friends",]).get(
|
||||
name="Kate"
|
||||
)
|
||||
|
||||
assert len(kate_check.also_friends) == 1
|
||||
assert kate_check.also_friends[0].name == "Billy"
|
||||
|
||||
@ -280,7 +280,7 @@ async def test_sort_order_on_many_to_many():
|
||||
assert users[1].cars[3].name == "Buggy"
|
||||
|
||||
users = (
|
||||
await User.objects.select_related(["cars", "cars__factory"])
|
||||
await User.objects.select_related(["cars__factory"])
|
||||
.order_by(["-cars__factory__name", "cars__name"])
|
||||
.all()
|
||||
)
|
||||
|
||||
@ -116,9 +116,7 @@ async def test_selecting_subset():
|
||||
)
|
||||
|
||||
all_cars = (
|
||||
await Car.objects.select_related(
|
||||
["manufacturer", "manufacturer__hq", "manufacturer__hq__nicks"]
|
||||
)
|
||||
await Car.objects.select_related(["manufacturer__hq__nicks"])
|
||||
.fields(
|
||||
[
|
||||
"id",
|
||||
@ -132,9 +130,7 @@ async def test_selecting_subset():
|
||||
)
|
||||
|
||||
all_cars2 = (
|
||||
await Car.objects.select_related(
|
||||
["manufacturer", "manufacturer__hq", "manufacturer__hq__nicks"]
|
||||
)
|
||||
await Car.objects.select_related(["manufacturer__hq__nicks"])
|
||||
.fields(
|
||||
{
|
||||
"id": ...,
|
||||
@ -149,9 +145,7 @@ async def test_selecting_subset():
|
||||
)
|
||||
|
||||
all_cars3 = (
|
||||
await Car.objects.select_related(
|
||||
["manufacturer", "manufacturer__hq", "manufacturer__hq__nicks"]
|
||||
)
|
||||
await Car.objects.select_related(["manufacturer__hq__nicks"])
|
||||
.fields(
|
||||
{
|
||||
"id": ...,
|
||||
|
||||
Reference in New Issue
Block a user