Avoid SubfieldBase deprecation warning in Django >= 1.8

#30 Merged at 9e840fb
Repository
rhertzog
Branch
get-rid-of-subfieldbase
Repository
schinckel
Branch
default
Author
  1. Raphaël Hertzog
Reviewers
Description

Starting with Django 1.8, JSONField will no longer JSON-decode strings that you assign to the field. Instead the strings will be considered as the value to store and they will be JSON-encoded in the database.

To avoid breaking applications running in the live, JSONField keeps doing that automatic JSON decode with older Django versions.

Comments (5)

  1. Matthew Schinckel repo owner

    To be honest, I think it would be better to have a jsonfield 2.0 that no longer uses SubFieldBase, but it's behaviour is consistent across all supported versions of django.

    1. Matthew Schinckel repo owner

      Hmm. It seems that from_db_value is only available in 1.8+.

      Since anything older than 1.8 is now unsupported, there's probably some value in restricting to that for 2.0.

      (Also, since I only use postgres, my interest in supporting this package post 1.8 is flagging).

  2. Raphaël Hertzog author

    So updated the PR as per your comments. We drop support of Django < 1.8, bump version to 1.0.0 (why 2.0 when we are in 0.9?) and behave the same across all versions.