{ "info": { "author": "DanteOnline", "author_email": "iamdanteonline@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# dantejsoncoder\n\ndantejsoncoder is a simple Django app to covert standard django-models to json\n\nQuick start\n-----------\n0. Install::\n\n `pip install django-dantejsoncoder`\n\n\n1. Add \"dantejsoncoder\" to your INSTALLED_APPS setting like this::\n ```\n INSTALLED_APPS = (\n ...\n 'dantejsoncoder',\n )\n ```\n\n2. Import::\n\n `from dantejsoncoder.coder import DanteEncoder`\n\n3. Simple way (all fields)::\n \n \"\"\"get QuerySet\"\"\"\n \n `objects = YourModel.objects.all()`\n \n \"\"\"return json result\"\"\"\n \n `return JsonResponse(objects, encoder=DanteEncoder)`\n \n4. If you need concrete fields in your model class add::\n \n `__to_json_fields__ = ('field1','field2',...)`\n\n5. If you need a special translation, add `__to_json_dict__` method in your model class::\n \n `def __to_json_dict__(self):\n return {'field_name': self.val. ... }`\n \n6. If you want to add something in the Encoder, use inheritance::\n\n ```\n class VirgilEncoder(DanteEncoder):\n def default(self, obj):\n if isinstance(obj, QuerySet):\n result = {}\n ...\n return result\n else:\n return super().default(obj)\n ```", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/DanteOnline/django-dantejsoncoder", "keywords": "", "license": "GNU General Public License v3.0", "maintainer": "", "maintainer_email": "", "name": "django-dantejsoncoder", "package_url": "https://pypi.org/project/django-dantejsoncoder/", "platform": "", "project_url": "https://pypi.org/project/django-dantejsoncoder/", "project_urls": { "Homepage": "https://github.com/DanteOnline/django-dantejsoncoder" }, "release_url": "https://pypi.org/project/django-dantejsoncoder/0.1/", "requires_dist": null, "requires_python": "", "summary": "A simple Django app to covert standard django-models to json", "version": "0.1" }, "last_serial": 3363446, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "3f0a033919a9299c3abeae3ecc07e3d5", "sha256": "88acc077344694ef233ae5f5556228f80f27dbd536ad4802c7d8b9de72ee35d4" }, "downloads": -1, "filename": "django-dantejsoncoder-0.1.tar.gz", "has_sig": false, "md5_digest": "3f0a033919a9299c3abeae3ecc07e3d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15329, "upload_time": "2017-11-25T20:22:16", "url": "https://files.pythonhosted.org/packages/59/e8/14b14d8cf6c84b5ccfa2bccc7f5c070594f705fc976a4e509f04a7710463/django-dantejsoncoder-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3f0a033919a9299c3abeae3ecc07e3d5", "sha256": "88acc077344694ef233ae5f5556228f80f27dbd536ad4802c7d8b9de72ee35d4" }, "downloads": -1, "filename": "django-dantejsoncoder-0.1.tar.gz", "has_sig": false, "md5_digest": "3f0a033919a9299c3abeae3ecc07e3d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15329, "upload_time": "2017-11-25T20:22:16", "url": "https://files.pythonhosted.org/packages/59/e8/14b14d8cf6c84b5ccfa2bccc7f5c070594f705fc976a4e509f04a7710463/django-dantejsoncoder-0.1.tar.gz" } ] }