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
a1b9737a
Kaydet (Commit)
a1b9737a
authored
Eki 23, 2015
tarafından
Andrey Kuzmin
Kaydeden (comit)
Tim Graham
Eki 23, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Cached model field_names in Python Deserializer.
üst
10ace52a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
python.py
django/core/serializers/python.py
+5
-1
No files found.
django/core/serializers/python.py
Dosyayı görüntüle @
a1b9737a
...
@@ -89,6 +89,7 @@ def Deserializer(object_list, **options):
...
@@ -89,6 +89,7 @@ def Deserializer(object_list, **options):
"""
"""
db
=
options
.
pop
(
'using'
,
DEFAULT_DB_ALIAS
)
db
=
options
.
pop
(
'using'
,
DEFAULT_DB_ALIAS
)
ignore
=
options
.
pop
(
'ignorenonexistent'
,
False
)
ignore
=
options
.
pop
(
'ignorenonexistent'
,
False
)
field_names_cache
=
{}
# Model: <list of field_names>
for
d
in
object_list
:
for
d
in
object_list
:
# Look up the model and starting build a dict of data for it.
# Look up the model and starting build a dict of data for it.
...
@@ -106,7 +107,10 @@ def Deserializer(object_list, **options):
...
@@ -106,7 +107,10 @@ def Deserializer(object_list, **options):
except
Exception
as
e
:
except
Exception
as
e
:
raise
base
.
DeserializationError
.
WithData
(
e
,
d
[
'model'
],
d
.
get
(
'pk'
),
None
)
raise
base
.
DeserializationError
.
WithData
(
e
,
d
[
'model'
],
d
.
get
(
'pk'
),
None
)
m2m_data
=
{}
m2m_data
=
{}
field_names
=
{
f
.
name
for
f
in
Model
.
_meta
.
get_fields
()}
if
Model
not
in
field_names_cache
:
field_names_cache
[
Model
]
=
{
f
.
name
for
f
in
Model
.
_meta
.
get_fields
()}
field_names
=
field_names_cache
[
Model
]
# Handle each field
# Handle each field
for
(
field_name
,
field_value
)
in
six
.
iteritems
(
d
[
"fields"
]):
for
(
field_name
,
field_value
)
in
six
.
iteritems
(
d
[
"fields"
]):
...
...
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