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
a7b7f27c
Kaydet (Commit)
a7b7f27c
authored
Agu 07, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #25233 -- Fixed HStoreField.has_changed() handling of initial values.
Thanks Simon Charette for review.
üst
6ed613b2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
9 deletions
+16
-9
hstore.py
django/contrib/postgres/forms/hstore.py
+8
-7
1.8.4.txt
docs/releases/1.8.4.txt
+2
-2
test_hstore.py
tests/postgres_tests/test_hstore.py
+6
-0
No files found.
django/contrib/postgres/forms/hstore.py
Dosyayı görüntüle @
a7b7f27c
...
...
@@ -23,13 +23,14 @@ class HStoreField(forms.CharField):
def
to_python
(
self
,
value
):
if
not
value
:
return
{}
try
:
value
=
json
.
loads
(
value
)
except
ValueError
:
raise
ValidationError
(
self
.
error_messages
[
'invalid_json'
],
code
=
'invalid_json'
,
)
if
not
isinstance
(
value
,
dict
):
try
:
value
=
json
.
loads
(
value
)
except
ValueError
:
raise
ValidationError
(
self
.
error_messages
[
'invalid_json'
],
code
=
'invalid_json'
,
)
# Cast everything to strings for ease.
for
key
,
val
in
value
.
items
():
value
[
key
]
=
six
.
text_type
(
val
)
...
...
docs/releases/1.8.4.txt
Dosyayı görüntüle @
a7b7f27c
...
...
@@ -22,5 +22,5 @@ Bugfixes
* Prevented an exception in ``TestCase.setUpTestData()`` from leaking the
transaction (:ticket:`25176`).
* Fixed ``has_changed()`` method in
:class:`django.contrib.postgres.forms.HStoreField`
.
* Fixed ``has_changed()`` method in
``contrib.postgres.forms.HStoreField``
(:ticket:`25215`, :ticket:`25233`)
.
tests/postgres_tests/test_hstore.py
Dosyayı görüntüle @
a7b7f27c
...
...
@@ -206,6 +206,12 @@ class TestFormField(PostgreSQLTestCase):
form_w_hstore
=
HStoreFormTest
({
'f1'
:
'{"a": 2}'
},
initial
=
{
'f1'
:
'{"a": 1}'
})
self
.
assertTrue
(
form_w_hstore
.
has_changed
())
form_w_hstore
=
HStoreFormTest
({
'f1'
:
'{"a": 1}'
},
initial
=
{
'f1'
:
{
"a"
:
1
}})
self
.
assertFalse
(
form_w_hstore
.
has_changed
())
form_w_hstore
=
HStoreFormTest
({
'f1'
:
'{"a": 2}'
},
initial
=
{
'f1'
:
{
"a"
:
1
}})
self
.
assertTrue
(
form_w_hstore
.
has_changed
())
class
TestValidator
(
PostgreSQLTestCase
):
...
...
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