Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

METADATA 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. Metadata-Version: 2.0
  2. Name: jsonfield
  3. Version: 2.0.2
  4. Summary: A reusable Django field that allows you to store validated JSON in your model.
  5. Home-page: https://github.com/dmkoch/django-jsonfield/
  6. Author: Dan Koch
  7. Author-email: dmkoch@gmail.com
  8. License: MIT
  9. Platform: UNKNOWN
  10. Classifier: Environment :: Web Environment
  11. Classifier: Intended Audience :: Developers
  12. Classifier: Operating System :: OS Independent
  13. Classifier: Programming Language :: Python
  14. Classifier: Programming Language :: Python :: 2.7
  15. Classifier: Programming Language :: Python :: 3
  16. Classifier: Programming Language :: Python :: 3.3
  17. Classifier: Programming Language :: Python :: 3.4
  18. Classifier: Programming Language :: Python :: 3.5
  19. Classifier: Programming Language :: Python :: 3.6
  20. Classifier: Framework :: Django
  21. Requires-Dist: Django (>=1.8.0)
  22. django-jsonfield
  23. ----------------
  24. django-jsonfield is a reusable Django field that allows you to store validated JSON in your model.
  25. It silently takes care of serialization. To use, simply add the field to one of your models.
  26. Python 3 & Django 1.8 through 1.11 supported!
  27. **Use PostgreSQL?** 1.0.0 introduced a breaking change to the underlying data type, so if you were using < 1.0.0 please read https://github.com/dmkoch/django-jsonfield/issues/57 before upgrading. Also, consider switching to Django's native JSONField that was added in Django 1.9.
  28. **Note:** There are a couple of third-party add-on JSONFields for Django. This project is django-jsonfield here on GitHub but is named `jsonfield on PyPI`_. There is another `django-jsonfield on Bitbucket`_, but that one is `django-jsonfield on PyPI`_. I realize this naming conflict is confusing and I am open to merging the two projects.
  29. .. _jsonfield on PyPI: https://pypi.python.org/pypi/jsonfield
  30. .. _django-jsonfield on Bitbucket: https://bitbucket.org/schinckel/django-jsonfield
  31. .. _django-jsonfield on PyPI: https://pypi.python.org/pypi/django-jsonfield
  32. **Note:** Django 1.9 added native PostgreSQL JSON support in `django.contrib.postgres.fields.JSONField`_. This module is still useful if you need to support JSON in databases other than PostgreSQL or are creating a third-party module that needs to be database-agnostic. But if you're an end user using PostgreSQL and want full-featured JSON support, I recommend using the built-in JSONField from Django instead of this module.
  33. .. _django.contrib.postgres.fields.JSONField: https://docs.djangoproject.com/en/dev/ref/contrib/postgres/fields/#jsonfield
  34. **Note:** Semver is followed after the 1.0 release.
  35. Installation
  36. ------------
  37. .. code-block:: python
  38. pip install jsonfield
  39. Usage
  40. -----
  41. .. code-block:: python
  42. from django.db import models
  43. from jsonfield import JSONField
  44. class MyModel(models.Model):
  45. json = JSONField()
  46. Advanced Usage
  47. --------------
  48. By default python deserializes json into dict objects. This behavior differs from the standard json behavior because python dicts do not have ordered keys.
  49. To overcome this limitation and keep the sort order of OrderedDict keys the deserialisation can be adjusted on model initialisation:
  50. .. code-block:: python
  51. import collections
  52. class MyModel(models.Model):
  53. json = JSONField(load_kwargs={'object_pairs_hook': collections.OrderedDict})
  54. Other Fields
  55. ------------
  56. **jsonfield.JSONCharField**
  57. If you need to use your JSON field in an index or other constraint, you can use **JSONCharField** which subclasses **CharField** instead of **TextField**. You'll also need to specify a **max_length** parameter if you use this field.
  58. Compatibility
  59. --------------
  60. django-jsonfield aims to support the same versions of Django currently maintained by the main Django project. See `Django supported versions`_, currently:
  61. * Django 1.8 (LTS) with Python 2.7, 3.3, 3.4, or 3.5
  62. * Django 1.9 with Python 2.7, 3.4, or 3.5
  63. * Django 1.10 with Python 2.7, 3.4, or 3.5
  64. * Django 1.11 (LTS) with Python 2.7, 3.4, 3.5 or 3.6
  65. .. _Django supported versions: https://www.djangoproject.com/download/#supported-versions
  66. Testing django-jsonfield Locally
  67. --------------------------------
  68. To test against all supported versions of Django:
  69. .. code-block:: shell
  70. $ docker-compose build && docker-compose up
  71. Or just one version (for example Django 1.10 on Python 3.5):
  72. .. code-block:: shell
  73. $ docker-compose build && docker-compose run tox tox -e py35-1.10
  74. Travis CI
  75. ---------
  76. .. image:: https://travis-ci.org/dmkoch/django-jsonfield.svg?branch=master
  77. :target: https://travis-ci.org/dmkoch/django-jsonfield
  78. Contact
  79. -------
  80. Web: http://bradjasper.com
  81. Twitter: `@bradjasper`_
  82. Email: `contact@bradjasper.com`_
  83. .. _contact@bradjasper.com: mailto:contact@bradjasper.com
  84. .. _@bradjasper: https://twitter.com/bradjasper
  85. Changes
  86. -------
  87. Take a look at the `changelog`_.
  88. .. _changelog: https://github.com/dmkoch/django-jsonfield/blob/master/CHANGES.rst