Fixed #24844 -- Corrected has_changed implementation for HStoreField.

Backport of 43b2d88a5b from master
This commit is contained in:
Andrea Grandi 2015-05-24 15:56:48 +01:00 committed by Tim Graham
parent 2aa2b9f291
commit 62c19a21b6
3 changed files with 20 additions and 1 deletions

View file

@ -4,6 +4,7 @@ from django.contrib.postgres import forms
from django.contrib.postgres.fields import HStoreField
from django.contrib.postgres.validators import KeysValidator
from django.core import exceptions, serializers
from django.forms import Form
from django.test import TestCase
from .models import HStoreModel
@ -174,6 +175,12 @@ class TestFormField(TestCase):
form_field = model_field.formfield()
self.assertIsInstance(form_field, forms.HStoreField)
def test_empty_field_has_not_changed(self):
class HStoreFormTest(Form):
f1 = HStoreField()
form_w_hstore = HStoreFormTest()
self.assertFalse(form_w_hstore.has_changed())
class TestValidator(TestCase):