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
75c87e2d
Kaydet (Commit)
75c87e2d
authored
Agu 05, 2013
tarafından
Tim Heap
Kaydeden (comit)
Tim Graham
Agu 05, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #20850 -- Added MultiWidget.needs_multipart_form
üst
6d88d47b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
widgets.py
django/forms/widgets.py
+5
-0
test_widgets.py
tests/forms_tests/tests/test_widgets.py
+8
-0
No files found.
django/forms/widgets.py
Dosyayı görüntüle @
75c87e2d
...
...
@@ -840,6 +840,11 @@ class MultiWidget(Widget):
obj
.
widgets
=
copy
.
deepcopy
(
self
.
widgets
)
return
obj
@property
def
needs_multipart_form
(
self
):
return
any
(
w
.
needs_multipart_form
for
w
in
self
.
widgets
)
class
SplitDateTimeWidget
(
MultiWidget
):
"""
A Widget that splits datetime input into two <input type="text"> boxes.
...
...
tests/forms_tests/tests/test_widgets.py
Dosyayı görüntüle @
75c87e2d
...
...
@@ -849,6 +849,14 @@ beatle J R Ringo False""")
w
=
MyMultiWidget
(
widgets
=
(
TextInput
(
attrs
=
{
'class'
:
'big'
}),
TextInput
(
attrs
=
{
'class'
:
'small'
})),
attrs
=
{
'id'
:
'bar'
})
self
.
assertHTMLEqual
(
w
.
render
(
'name'
,
[
'john'
,
'lennon'
]),
'<input id="bar_0" type="text" class="big" value="john" name="name_0" /><br /><input id="bar_1" type="text" class="small" value="lennon" name="name_1" />'
)
# Test needs_multipart_form=True if any widget needs it
w
=
MyMultiWidget
(
widgets
=
(
TextInput
(),
FileInput
()))
self
.
assertTrue
(
w
.
needs_multipart_form
)
# Test needs_multipart_form=False if no widget needs it
w
=
MyMultiWidget
(
widgets
=
(
TextInput
(),
TextInput
()))
self
.
assertFalse
(
w
.
needs_multipart_form
)
def
test_splitdatetime
(
self
):
w
=
SplitDateTimeWidget
()
self
.
assertHTMLEqual
(
w
.
render
(
'date'
,
''
),
'<input type="text" name="date_0" /><input type="text" name="date_1" />'
)
...
...
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