Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
d43aa28f
Kaydet (Commit)
d43aa28f
authored
Şub 26, 2015
tarafından
Anssi Kääriäinen
Kaydeden (comit)
Tim Graham
Mar 25, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Removed field.field check in setup_joins()
üst
b68212f5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
12 deletions
+14
-12
related.py
django/db/models/fields/related.py
+10
-0
compiler.py
django/db/models/sql/compiler.py
+1
-1
query.py
django/db/models/sql/query.py
+3
-11
No files found.
django/db/models/fields/related.py
Dosyayı görüntüle @
d43aa28f
...
...
@@ -1342,6 +1342,16 @@ class ForeignObjectRel(object):
def
get_prep_lookup
(
self
,
lookup_name
,
value
):
return
self
.
field
.
get_prep_lookup
(
lookup_name
,
value
)
@cached_property
def
target_field
(
self
):
target_fields
=
self
.
get_path_info
()
.
target_fields
if
len
(
target_fields
)
>
1
:
raise
RuntimeError
(
"Multicolumn relations do not have a single target_field."
)
return
target_fields
[
0
]
def
get_lookup
(
self
,
lookup_name
):
return
self
.
field
.
get_lookup
(
lookup_name
)
def
get_internal_type
(
self
):
return
self
.
field
.
get_internal_type
()
...
...
django/db/models/sql/compiler.py
Dosyayı görüntüle @
d43aa28f
...
...
@@ -547,7 +547,7 @@ class SQLCompiler(object):
# If we get to this point and the field is a relation to another model,
# append the default ordering for that model unless the attribute name
# of the field is specified.
if
field
.
rel
and
path
and
opts
.
ordering
and
name
!=
field
.
attname
:
if
field
.
is_relation
and
path
and
opts
.
ordering
and
name
!=
field
.
attname
:
# Firstly, avoid infinite loops.
if
not
already_seen
:
already_seen
=
set
()
...
...
django/db/models/sql/query.py
Dosyayı görüntüle @
d43aa28f
...
...
@@ -1038,7 +1038,7 @@ class Query(object):
"""
Checks the type of object passed to query relations.
"""
if
field
.
rel
:
if
field
.
is_relation
:
# QuerySets implement is_compatible_query_object_type() to
# determine compatibility with the given field.
if
hasattr
(
value
,
'is_compatible_query_object_type'
):
...
...
@@ -1164,16 +1164,10 @@ class Query(object):
# No support for transforms for relational fields
assert
len
(
lookups
)
==
1
lookup_class
=
field
.
get_lookup
(
lookups
[
0
])
# Undo the changes done in setup_joins() if hasattr(final_field, 'field') branch
# This hack is needed as long as the field.rel isn't like a real field.
if
field
.
get_path_info
()[
-
1
]
.
target_fields
!=
sources
:
target_field
=
field
.
rel
else
:
target_field
=
field
if
len
(
targets
)
==
1
:
lhs
=
targets
[
0
]
.
get_col
(
alias
,
target_
field
)
lhs
=
targets
[
0
]
.
get_col
(
alias
,
field
)
else
:
lhs
=
MultiColSource
(
alias
,
targets
,
sources
,
target_
field
)
lhs
=
MultiColSource
(
alias
,
targets
,
sources
,
field
)
condition
=
lookup_class
(
lhs
,
value
)
lookup_type
=
lookup_class
.
lookup_name
else
:
...
...
@@ -1384,8 +1378,6 @@ class Query(object):
reuse
=
can_reuse
if
join
.
m2m
else
None
alias
=
self
.
join
(
connection
,
reuse
=
reuse
)
joins
.
append
(
alias
)
if
hasattr
(
final_field
,
'field'
):
final_field
=
final_field
.
field
return
final_field
,
targets
,
opts
,
joins
,
path
def
trim_joins
(
self
,
targets
,
joins
,
path
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment