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
15641950
Unverified
Kaydet (Commit)
15641950
authored
Tem 20, 2018
tarafından
Tim Graham
Kaydeden (comit)
GitHub
Tem 20, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Improved inspectdb readability with namedtuple attributes.
üst
45808895
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
inspectdb.py
django/core/management/commands/inspectdb.py
+10
-10
No files found.
django/core/management/commands/inspectdb.py
Dosyayı görüntüle @
15641950
...
...
@@ -93,7 +93,7 @@ class Command(BaseCommand):
for
row
in
table_description
:
comment_notes
=
[]
# Holds Field notes, to be displayed in a Python comment.
extra_params
=
OrderedDict
()
# Holds Field parameters such as 'db_column'.
column_name
=
row
[
0
]
column_name
=
row
.
name
is_relation
=
column_name
in
relations
att_name
,
params
,
notes
=
self
.
normalize_col_name
(
...
...
@@ -138,7 +138,7 @@ class Command(BaseCommand):
# Add 'null' and 'blank', if the 'null_ok' flag was present in the
# table description.
if
row
[
6
]
:
# If it's NULL...
if
row
.
null_ok
:
# If it's NULL...
extra_params
[
'blank'
]
=
True
extra_params
[
'null'
]
=
True
...
...
@@ -229,7 +229,7 @@ class Command(BaseCommand):
field_notes
=
[]
try
:
field_type
=
connection
.
introspection
.
get_field_type
(
row
[
1
]
,
row
)
field_type
=
connection
.
introspection
.
get_field_type
(
row
.
type_code
,
row
)
except
KeyError
:
field_type
=
'TextField'
field_notes
.
append
(
'This field type is a guess.'
)
...
...
@@ -241,19 +241,19 @@ class Command(BaseCommand):
field_params
.
update
(
new_params
)
# Add max_length for all CharFields.
if
field_type
==
'CharField'
and
row
[
3
]
:
field_params
[
'max_length'
]
=
int
(
row
[
3
]
)
if
field_type
==
'CharField'
and
row
.
internal_size
:
field_params
[
'max_length'
]
=
int
(
row
.
internal_size
)
if
field_type
==
'DecimalField'
:
if
row
[
4
]
is
None
or
row
[
5
]
is
None
:
if
row
.
precision
is
None
or
row
.
scale
is
None
:
field_notes
.
append
(
'max_digits and decimal_places have been guessed, as this '
'database handles decimal fields as float'
)
field_params
[
'max_digits'
]
=
row
[
4
]
if
row
[
4
]
is
not
None
else
10
field_params
[
'decimal_places'
]
=
row
[
5
]
if
row
[
5
]
is
not
None
else
5
field_params
[
'max_digits'
]
=
row
.
precision
if
row
.
precision
is
not
None
else
10
field_params
[
'decimal_places'
]
=
row
.
scale
if
row
.
scale
is
not
None
else
5
else
:
field_params
[
'max_digits'
]
=
row
[
4
]
field_params
[
'decimal_places'
]
=
row
[
5
]
field_params
[
'max_digits'
]
=
row
.
precision
field_params
[
'decimal_places'
]
=
row
.
scale
return
field_type
,
field_params
,
field_notes
...
...
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