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
7e09fa7f
Kaydet (Commit)
7e09fa7f
authored
Mar 21, 2017
tarafından
Kapil Garg
Kaydeden (comit)
Tim Graham
Mar 23, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #27969 -- Fixed models.Field.formfield() setting 'disabled' for fields with choices.
üst
075f13e4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
__init__.py
django/db/models/fields/__init__.py
+1
-1
tests.py
tests/model_fields/tests.py
+6
-0
No files found.
django/db/models/fields/__init__.py
Dosyayı görüntüle @
7e09fa7f
...
@@ -850,7 +850,7 @@ class Field(RegisterLookupMixin):
...
@@ -850,7 +850,7 @@ class Field(RegisterLookupMixin):
for
k
in
list
(
kwargs
):
for
k
in
list
(
kwargs
):
if
k
not
in
(
'coerce'
,
'empty_value'
,
'choices'
,
'required'
,
if
k
not
in
(
'coerce'
,
'empty_value'
,
'choices'
,
'required'
,
'widget'
,
'label'
,
'initial'
,
'help_text'
,
'widget'
,
'label'
,
'initial'
,
'help_text'
,
'error_messages'
,
'show_hidden_initial'
):
'error_messages'
,
'show_hidden_initial'
,
'disabled'
):
del
kwargs
[
k
]
del
kwargs
[
k
]
defaults
.
update
(
kwargs
)
defaults
.
update
(
kwargs
)
if
form_class
is
None
:
if
form_class
is
None
:
...
...
tests/model_fields/tests.py
Dosyayı görüntüle @
7e09fa7f
...
@@ -54,6 +54,12 @@ class BasicFieldTests(TestCase):
...
@@ -54,6 +54,12 @@ class BasicFieldTests(TestCase):
klass
=
forms
.
TypedMultipleChoiceField
klass
=
forms
.
TypedMultipleChoiceField
self
.
assertIsInstance
(
field
.
formfield
(
choices_form_class
=
klass
),
klass
)
self
.
assertIsInstance
(
field
.
formfield
(
choices_form_class
=
klass
),
klass
)
def
test_formfield_disabled
(
self
):
"""Field.formfield() sets disabled for fields with choices."""
field
=
models
.
CharField
(
choices
=
[(
'a'
,
'b'
)])
form_field
=
field
.
formfield
(
disabled
=
True
)
self
.
assertIs
(
form_field
.
disabled
,
True
)
def
test_field_str
(
self
):
def
test_field_str
(
self
):
f
=
models
.
Field
()
f
=
models
.
Field
()
self
.
assertEqual
(
str
(
f
),
'<django.db.models.fields.Field>'
)
self
.
assertEqual
(
str
(
f
),
'<django.db.models.fields.Field>'
)
...
...
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