mirror of
https://github.com/django/django.git
synced 2025-08-08 21:08:25 +00:00
Fixed #24844 -- Corrected has_changed implementation for HStoreField.
Backport of 43b2d88a5b
from master
This commit is contained in:
parent
2aa2b9f291
commit
62c19a21b6
3 changed files with 20 additions and 1 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue