{ "info": { "author": "Tome Cvitan", "author_email": "tome@cvitan.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Libraries" ], "description": "**Note:** This is basically a standalone version of the JSONB support in the Postgres contrib package of the Django master branch, targeted for the Django 1.9 release. \n\nJSONField\n---------\n\n.. class:: JSONField(**options)\n\n A field for storing JSON encoded data. In Python the data is represented in\n its Python native format: dictionaries, lists, strings, numbers, booleans\n and ``None``.\n\n.. note::\n\n PostgreSQL has two native JSON based data types: ``json`` and ``jsonb``.\n The main difference between them is how they are stored and how they can be\n queried. PostgreSQL's ``json`` field is stored as the original string\n representation of the JSON and must be decoded on the fly when queried\n based on keys. The ``jsonb`` field is stored based on the actual structure\n of the JSON which allows indexing. The trade-off is a small additional cost\n on writing to the ``jsonb`` field. ``JSONField`` uses ``jsonb``.\n\n **This field is only supported on PostgreSQL versions at least 9.4**.\n\n\nQuerying JSONField\n==================\n\nWe will use the following example model::\n\n from django.contrib.postgres.fields import JSONField\n from django.db import models\n\n class Dog(models.Model):\n name = models.CharField(max_length=200)\n data = JSONField()\n\n def __str__(self): # __unicode__ on Python 2\n return self.name\n\n.. fieldlookup:: jsonfield.key\n\nKey, index, and path lookups\n============================\n\nTo query based on a given dictionary key, simply use that key as the lookup\nname::\n\n >>> Dog.objects.create(name='Rufus', data={\n ... 'breed': 'labrador',\n ... 'owner': {\n ... 'name': 'Bob',\n ... 'other_pets': [{\n ... 'name': 'Fishy',\n ... }],\n ... },\n ... })\n >>> Dog.objects.create(name='Meg', data={'breed': 'collie'})\n\n >>> Dog.objects.filter(data__breed='collie')\n []\n\nMultiple keys can be chained together to form a path lookup::\n\n >>> Dog.objects.filter(data__owner__name='Bob')\n []\n\nIf the key is an integer, it will be interpreted as an index lookup in an\narray::\n\n >>> Dog.objects.filter(data__owner__other_pets__0__name='Fishy')\n []\n\nIf the key you wish to query by clashes with the name of another lookup, use\nthe :lookup:`jsonfield.contains` lookup instead.\n\nIf only one key or index is used, the SQL operator ``->`` is used. If multiple\noperators are used then the ``#>`` operator is used.\n\n.. warning::\n\n Since any string could be a key in a json object, any lookup other than\n those listed below will be interpreted as a key lookup. No errors are\n raised. Be extra careful for typing mistakes, and always check your queries\n work as you intend.\n\nContainment and key operations\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. fieldlookup:: jsonfield.contains\n.. fieldlookup:: jsonfield.contained_by\n.. fieldlookup:: jsonfield.has_key\n.. fieldlookup:: jsonfield.has_any_keys\n.. fieldlookup:: jsonfield.has_keys\n\n:class:`~django.contrib.postgres.fields.JSONField` shares lookups relating to\ncontainment and keys with :class:`~django.contrib.postgres.fields.HStoreField`.\n\n- :lookup:`contains ` (accepts any JSON rather than\n just a dictionary of strings)\n- :lookup:`contained_by ` (accepts any JSON\n rather than just a dictionary of strings)\n- :lookup:`has_key `\n- :lookup:`has_any_keys `\n- :lookup:`has_keys `", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/totalgood/django-jsonbfield/", "keywords": "django postgres jsonb", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-jsonbfield", "package_url": "https://pypi.org/project/django-jsonbfield/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-jsonbfield/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/totalgood/django-jsonbfield/" }, "release_url": "https://pypi.org/project/django-jsonbfield/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Django JSONField that utilized PostGRESQL jsonb field type", "version": "0.1.0" }, "last_serial": 1845980, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "00d30b05238ef965e968a3c7a6cb2cff", "sha256": "2854bdaf25689dfe3054c18ee3c70df11c77267ffbbdc8cb9ced530f78323477" }, "downloads": -1, "filename": "django-jsonbfield-0.1.0.tar.gz", "has_sig": false, "md5_digest": "00d30b05238ef965e968a3c7a6cb2cff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5294, "upload_time": "2015-12-04T02:13:47", "url": "https://files.pythonhosted.org/packages/49/d1/b32dcbfbcc8b36b615fe07715ab293e7a4e4a4fd272dae398d141bd7dfb4/django-jsonbfield-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "00d30b05238ef965e968a3c7a6cb2cff", "sha256": "2854bdaf25689dfe3054c18ee3c70df11c77267ffbbdc8cb9ced530f78323477" }, "downloads": -1, "filename": "django-jsonbfield-0.1.0.tar.gz", "has_sig": false, "md5_digest": "00d30b05238ef965e968a3c7a6cb2cff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5294, "upload_time": "2015-12-04T02:13:47", "url": "https://files.pythonhosted.org/packages/49/d1/b32dcbfbcc8b36b615fe07715ab293e7a4e4a4fd272dae398d141bd7dfb4/django-jsonbfield-0.1.0.tar.gz" } ] }