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
26d0023c
Kaydet (Commit)
26d0023c
authored
Haz 18, 2016
tarafından
Tim Graham
Kaydeden (comit)
GitHub
Haz 18, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #15667 -- Fixed crash when indexing RadioFieldRenderer with ModelChoiceIterator.
Regression in
86573861
üst
f7a363ee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
widgets.py
django/forms/widgets.py
+1
-1
tests.py
tests/model_forms/tests.py
+7
-0
No files found.
django/forms/widgets.py
Dosyayı görüntüle @
26d0023c
...
...
@@ -693,7 +693,7 @@ class ChoiceFieldRenderer(object):
self
.
choices
=
choices
def
__getitem__
(
self
,
idx
):
choice
=
self
.
choices
[
idx
]
# Let the IndexError propagate
choice
=
list
(
self
.
choices
)
[
idx
]
# Let the IndexError propagate
return
self
.
choice_input_class
(
self
.
name
,
self
.
value
,
self
.
attrs
.
copy
(),
choice
,
idx
)
def
__str__
(
self
):
...
...
tests/model_forms/tests.py
Dosyayı görüntüle @
26d0023c
...
...
@@ -1593,6 +1593,13 @@ class ModelChoiceFieldTests(TestCase):
with
self
.
assertNumQueries
(
1
):
template
.
render
(
Context
({
'field'
:
field
}))
def
test_modelchoicefield_index_renderer
(
self
):
field
=
forms
.
ModelChoiceField
(
Category
.
objects
.
all
(),
widget
=
forms
.
RadioSelect
)
self
.
assertEqual
(
str
(
field
.
widget
.
get_renderer
(
'foo'
,
[])[
0
]),
'<label><input name="foo" type="radio" value="" /> ---------</label>'
)
def
test_modelchoicefield_iterator
(
self
):
"""
Iterator defaults to ModelChoiceIterator and can be overridden with
...
...
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