Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#24844 closed Bug (fixed)

HStore Form Field falsely report has_changed

Reported by: Ramez Issac Owned by: Andrea Grandi
Component: contrib.postgres Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: yes


Consider this simple Test

from django import forms
from django.contrib.postgres.forms import HStoreField

class HStoreForm(forms.Form):
    f1 = HStoreField()

class TextForm(forms.Form):
    f1 = forms.Textarea()

form_w_hstore = HStoreForm()
assert form_w_hstore.has_changed() is False #Fails

form_w_textarea = TextForm()
assert form_w_textarea.has_changed() is False #Passes

Change History (6)

comment:1 by Andrea Grandi, 9 years ago

Triage Stage: UnreviewedAccepted

Triaged in this example project
Running the tests with: python test
they fails with:

(django18)➜  ticket_24844_hstore git:(master) python test
Creating test database for alias 'default'...
ERROR: hstore.tests (unittest.loader.ModuleImportFailure)
ImportError: Failed to import test module: hstore.tests
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/", line 254, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/", line 232, in _get_module_from_name
  File "/Users/andrea/Projects/Django/ticket-24844-hstore/ticket_24844_hstore/hstore/", line 16, in <module>
    assert form_w_hstore.has_changed() is False #Fails

Ran 1 test in 0.000s

FAILED (errors=1)
Destroying test database for alias 'default'...

comment:2 by Andrea Grandi, 9 years ago

Owner: set to Andrea Grandi
Status: newassigned

comment:3 by Andrea Grandi, 9 years ago

Has patch: set

I try to fix the bug with this PR

comment:4 by Florian Apolloner <florian@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In 43b2d88:

Fixed #24844 -- Corrected has_changed implementation for HStoreField.

comment:5 by Tim Graham <timograham@…>, 9 years ago

In f4cb350c:

Added release notes for refs #24844.

comment:6 by Tim Graham <timograham@…>, 9 years ago

In 62c19a21:

Fixed #24844 -- Corrected has_changed implementation for HStoreField.

Backport of 43b2d88a5b9cfb151ccf7ac861f2750e70c0e2c4 from master

Note: See TracTickets for help on using tickets.
Back to Top