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
7bbd17bf
Kaydet (Commit)
7bbd17bf
authored
Ock 31, 2013
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #19341 -- Detected NullBooleanField when introspecting models
Thanks Tim Bowden for the report.
üst
3c0a81aa
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
+6
-3
inspectdb.py
django/core/management/commands/inspectdb.py
+3
-0
models.py
tests/regressiontests/inspectdb/models.py
+1
-1
tests.py
tests/regressiontests/inspectdb/tests.py
+2
-2
No files found.
django/core/management/commands/inspectdb.py
Dosyayı görüntüle @
7bbd17bf
...
...
@@ -108,6 +108,9 @@ class Command(NoArgsCommand):
# Add 'null' and 'blank', if the 'null_ok' flag was present in the
# table description.
if
row
[
6
]:
# If it's NULL...
if
field_type
==
'BooleanField('
:
field_type
=
'NullBooleanField('
else
:
extra_params
[
'blank'
]
=
True
if
not
field_type
in
(
'TextField('
,
'CharField('
):
extra_params
[
'null'
]
=
True
...
...
tests/regressiontests/inspectdb/models.py
Dosyayı görüntüle @
7bbd17bf
...
...
@@ -34,6 +34,7 @@ class ColumnTypes(models.Model):
id
=
models
.
AutoField
(
primary_key
=
True
)
field1
=
models
.
BigIntegerField
()
field2
=
models
.
BooleanField
()
field2b
=
models
.
NullBooleanField
()
field3
=
models
.
CharField
(
max_length
=
10
)
field4
=
models
.
CommaSeparatedIntegerField
(
max_length
=
99
)
field5
=
models
.
DateField
()
...
...
@@ -46,7 +47,6 @@ class ColumnTypes(models.Model):
field12
=
models
.
IntegerField
()
field13
=
models
.
IPAddressField
()
field14
=
models
.
GenericIPAddressField
(
protocol
=
"ipv4"
)
field15
=
models
.
NullBooleanField
()
field16
=
models
.
PositiveIntegerField
()
field17
=
models
.
PositiveSmallIntegerField
()
field18
=
models
.
SlugField
()
...
...
tests/regressiontests/inspectdb/tests.py
Dosyayı görüntüle @
7bbd17bf
...
...
@@ -39,8 +39,10 @@ class InspectDBTestCase(TestCase):
if
connection
.
vendor
==
'mysql'
:
# No native boolean type on MySQL
assertFieldType
(
'field2'
,
"models.IntegerField()"
)
assertFieldType
(
'field2b'
,
"models.IntegerField(null=True, blank=True)"
)
else
:
assertFieldType
(
'field2'
,
"models.BooleanField()"
)
assertFieldType
(
'field2b'
,
"models.NullBooleanField()"
)
assertFieldType
(
'field3'
,
"models.CharField(max_length=10)"
)
# CommaSeparatedIntegerField
assertFieldType
(
'field4'
,
"models.CharField(max_length=99)"
)
...
...
@@ -68,8 +70,6 @@ class InspectDBTestCase(TestCase):
else
:
assertFieldType
(
'field13'
,
"models.CharField(max_length=15)"
)
assertFieldType
(
'field14'
,
"models.CharField(max_length=39)"
)
# Ticket #19341
#assertFieldType('field15', "models.NullBooleanField()")
if
connection
.
vendor
==
'sqlite'
:
assertFieldType
(
'field16'
,
"models.PositiveIntegerField()"
)
assertFieldType
(
'field17'
,
"models.PositiveSmallIntegerField()"
)
...
...
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