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
91f87b8f
Kaydet (Commit)
91f87b8f
authored
Mar 12, 2016
tarafından
quaspas
Kaydeden (comit)
Tim Graham
Mar 12, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #26283 -- Fixed removal of trailing nulls for SplitArrayField.
üst
ab8af342
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
array.py
django/contrib/postgres/forms/array.py
+1
-1
test_array.py
tests/postgres_tests/test_array.py
+14
-0
No files found.
django/contrib/postgres/forms/array.py
Dosyayı görüntüle @
91f87b8f
...
@@ -183,7 +183,7 @@ class SplitArrayField(forms.Field):
...
@@ -183,7 +183,7 @@ class SplitArrayField(forms.Field):
null_index
=
i
null_index
=
i
else
:
else
:
break
break
if
null_index
:
if
null_index
is
not
None
:
cleaned_data
=
cleaned_data
[:
null_index
]
cleaned_data
=
cleaned_data
[:
null_index
]
errors
=
errors
[:
null_index
]
errors
=
errors
[:
null_index
]
errors
=
list
(
filter
(
None
,
errors
))
errors
=
list
(
filter
(
None
,
errors
))
...
...
tests/postgres_tests/test_array.py
Dosyayı görüntüle @
91f87b8f
...
@@ -663,6 +663,20 @@ class TestSplitFormField(PostgreSQLTestCase):
...
@@ -663,6 +663,20 @@ class TestSplitFormField(PostgreSQLTestCase):
self
.
assertTrue
(
form
.
is_valid
(),
form
.
errors
)
self
.
assertTrue
(
form
.
is_valid
(),
form
.
errors
)
self
.
assertEqual
(
form
.
cleaned_data
,
{
'array'
:
[
'a'
,
''
,
'b'
]})
self
.
assertEqual
(
form
.
cleaned_data
,
{
'array'
:
[
'a'
,
''
,
'b'
]})
def
test_remove_trailing_nulls_not_required
(
self
):
class
SplitForm
(
forms
.
Form
):
array
=
SplitArrayField
(
forms
.
CharField
(
required
=
False
),
size
=
2
,
remove_trailing_nulls
=
True
,
required
=
False
,
)
data
=
{
'array_0'
:
''
,
'array_1'
:
''
}
form
=
SplitForm
(
data
)
self
.
assertTrue
(
form
.
is_valid
())
self
.
assertEqual
(
form
.
cleaned_data
,
{
'array'
:
[]})
def
test_required_field
(
self
):
def
test_required_field
(
self
):
class
SplitForm
(
forms
.
Form
):
class
SplitForm
(
forms
.
Form
):
array
=
SplitArrayField
(
forms
.
CharField
(),
size
=
3
)
array
=
SplitArrayField
(
forms
.
CharField
(),
size
=
3
)
...
...
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