Pull requests

#7 Merged
Repository
marccerrato
Branch
field-validation-error
Repository
schinckel
Branch
default

JSONFormField 'clean' method now calls its super class

Author
  1. Marc Cerrato
Reviewers
Description

Calling the super class clean method it's required because it does some really important checks like assuring input values are not empty when model field is not blank. In case of having a not null and not blank JSONField, empty values where allowed by the form field and ValidationError was raised in model field 'to_python' method because it couldn't be parsed to JSON.

  • Learn about pull requests

Comments (4)

  1. Matthew Schinckel repo owner

    I am seeing a test failure under python3 with this commit.

    ======================================================================
    ERROR: test_formfield_clean_blank (jsonfield.tests.base.JSONFieldTest)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/Users/matt/Development/django-jsonfield/jsonfield/tests/base.py", line 53, in test_formfield_clean_blank
        self.assertRaisesMessage(forms.ValidationError, formfield.error_messages['required'], formfield.clean, value='')
      File "/Users/matt/Development/django-jsonfield/.tox/py32/lib/python3.2/site-packages/django/test/testcases.py", line 315, in assertRaisesMessage
        re.escape(expected_message), callable_obj, *args, **kwargs)
      File "/Users/matt/Development/django-jsonfield/.tox/py32/lib/python3.2/re.py", line 247, in escape
        return bytes(s)
    TypeError: 'str' object cannot be interpreted as an integer
    
    ----------------------------------------------------------------------
    
    1. Matthew Schinckel repo owner

      Yes, tox is awesome. It's going to take me a while to get it set up everywhere, but it makes checking merges much faster.

      I'm also using drone.io for CI. I have a method of getting coverage badges from that, too.