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
c09bf8d7
Kaydet (Commit)
c09bf8d7
authored
Nis 15, 2017
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #28058 -- Restored empty BoundFields evaluating to True.
Regression in
b52c7300
üst
e5dce7b0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
boundfield.py
django/forms/boundfield.py
+4
-0
1.11.1.txt
docs/releases/1.11.1.txt
+3
-0
test_forms.py
tests/forms_tests/tests/test_forms.py
+7
-0
No files found.
django/forms/boundfield.py
Dosyayı görüntüle @
c09bf8d7
...
...
@@ -53,6 +53,10 @@ class BoundField:
for
widget
in
self
.
field
.
widget
.
subwidgets
(
self
.
html_name
,
self
.
value
(),
attrs
=
attrs
)
)
def
__bool__
(
self
):
# BoundField evaluates to True even if it doesn't have subwidgets.
return
True
def
__iter__
(
self
):
return
iter
(
self
.
subwidgets
)
...
...
docs/releases/1.11.1.txt
Dosyayı görüntüle @
c09bf8d7
...
...
@@ -24,3 +24,6 @@ Bugfixes
* Fixed empty POST data table appearing instead of "No POST data" in HTML debug
page (:ticket:`28079`).
* Restored ``BoundField``\s without any ``choices`` evaluating to ``True``
(:ticket:`28058`).
tests/forms_tests/tests/test_forms.py
Dosyayı görüntüle @
c09bf8d7
...
...
@@ -746,6 +746,13 @@ Java</label></li>
[
str
(
bf
[
1
]),
str
(
bf
[
2
]),
str
(
bf
[
3
])],
)
def
test_boundfield_bool
(
self
):
"""BoundField without any choices (subwidgets) evaluates to True."""
class
TestForm
(
Form
):
name
=
ChoiceField
(
choices
=
[])
self
.
assertIs
(
bool
(
TestForm
()[
'name'
]),
True
)
def
test_forms_with_multiple_choice
(
self
):
# MultipleChoiceField is a special case, as its data is required to be a list:
class
SongForm
(
Form
):
...
...
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