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
8d94d575
Kaydet (Commit)
8d94d575
authored
Ara 23, 2016
tarafından
Adam Chainz
Kaydeden (comit)
Tim Graham
Ara 23, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Used @cached_property in RawQuerySet.
üst
6ebf8f90
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
query.py
django/db/models/query.py
+9
-13
No files found.
django/db/models/query.py
Dosyayı görüntüle @
8d94d575
...
...
@@ -1241,38 +1241,34 @@ class RawQuerySet(object):
using
=
alias
,
)
@property
@
cached_
property
def
columns
(
self
):
"""
A list of model field names in the order they'll appear in the
query results.
"""
if
not
hasattr
(
self
,
'_columns'
):
self
.
_columns
=
self
.
query
.
get_columns
()
columns
=
self
.
query
.
get_columns
()
# Adjust any column names which don't match field names
for
(
query_name
,
model_name
)
in
self
.
translations
.
items
():
try
:
index
=
self
.
_
columns
.
index
(
query_name
)
self
.
_
columns
[
index
]
=
model_name
index
=
columns
.
index
(
query_name
)
columns
[
index
]
=
model_name
except
ValueError
:
# Ignore translations for non-existent column names
pass
return
columns
return
self
.
_columns
@property
@cached_property
def
model_fields
(
self
):
"""
A dict mapping column names to model field names.
"""
if
not
hasattr
(
self
,
'_model_fields'
):
converter
=
connections
[
self
.
db
]
.
introspection
.
table_name_converter
self
.
_
model_fields
=
{}
model_fields
=
{}
for
field
in
self
.
model
.
_meta
.
fields
:
name
,
column
=
field
.
get_attname_column
()
self
.
_
model_fields
[
converter
(
column
)]
=
field
return
self
.
_
model_fields
model_fields
[
converter
(
column
)]
=
field
return
model_fields
class
Prefetch
(
object
):
...
...
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