{ "info": { "author": "Melvyn Petrocchi", "author_email": "w4pity@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved", "Natural Language :: French", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "[![CircleCI](https://circleci.com/gh/zephirdeadline/djangoAPI_rest_object.svg?style=svg)](https://circleci.com/gh/zephirdeadline/djangoAPI_rest_object) [![Coverage Status](https://coveralls.io/repos/github/zephirdeadline/djangoAPI_rest_object/badge.svg)](https://coveralls.io/github/zephirdeadline/djangoAPI_rest_object)\n\nDOC: https://drive.w4pity.fr/drive/Rest_object_documentation.pdf\n\n## DEPENDANCE\n\n- Django\n- djangorestframework\n- djoser\n- djangorestframework-jwt\n\n\n## INSTALLATION\n\nin settings:\nConfigure REST_FRAMEWORK for the authentification you want\n```\n\nREST_FRAMEWORK = {\n 'DEFAULT_AUTHENTICATION_CLASSES': (\n 'rest_framework.authentication.TokenAuthentication',\n ),\n}\n```\nTips: You can also you JWT\n\nAdd on your INSTALL_APP:\n\n```\n'rest_object',\n'rest_framework',\n'rest_framework_jwt',\n'rest_framework.authtoken',\n'djoser',\n```\n\nAdd on your url path (identification, user management):\n\n``` \nurl(r'^auth/', include('djoser.urls')),\nurl(r'^auth/', include('djoser.urls.authtoken')),\nurl(r'^auth/', include('djoser.urls.jwt')),\n \n```\n\n\n\nUsage:\n\n1- Create your model ('Car' for example)\n2- Create your class serializer for this model ('CarSerializer' for example)\n3- Create a view for this model like this:\n```\ndef car(request, id_car=None, cursor=None, amount=None):\n return action(request, Car, CarSerializer, id_car, cursor, amount, is_restricted=False, linked_to_user=False)\n\n```\n4- Add 2 url for you model:\n```\nurl(r'car/$', views.car, name='car'), # 'car' \nurl(r'car/(?P\\d+)$', views.car, name='carid'),\nurl(r'car/(?P\\d+)/(?P\\d+)$', views.car, name='caramount'),\n```\n\nTips: An Activity example is avaible in the source code\n\n## API usage\n\nTips: Token can be replaced by JWT\n\nModel example:\n\n\nUser is a ForeignKey, so is_restricted ans linked_to_user need to be set as True\n\n```\nclass Sms(models.Model):\n user = models.ForeignKey(User, on_delete=models.CASCADE)\n text = models.TextField()\n sender = models.CharField(max_length=64)\n date = models.DateTimeField()\n```\n\nAdd Header Token/jwt only if you need it\n\n\n### QUERY\n\n> GET http://localhost:8000/api/sms/\n\nHEADER needed: \n\n> Authorization: Token e0ae370xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n> Content-Type: application/json\n\n\nRESPONSE:\n\n```\n[\n\t{\n\t \"id\": 1,\n\t\t\"sender\": \"Jacque\",\n\t\t\"date\": \"2008-04-10 11:47:58-05\",\n\t\t\"text\": \"je suis un sms\"\n\t},\n\t...\n]\n```\n\n### GET \n\n> GET http://localhost:8000/api/sms/{id}\n\nHEADER needed: \n\n> Authorization: Token e0ae370xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n> Content-Type: application/json\n\nRESPONSE:\n\n```\n\t{\n\t \"id\": 1,\n\t\t\"sender\": \"Jacque\",\n\t\t\"date\": \"2008-04-10 11:47:58-05\",\n\t\t\"text\": \"je suis un sms\"\n\t}\n```\n\n\n### POST\n\n> POST http://localhost:8000/api/sms/\n\nHEADER needed: \n\n> Authorization: Token e0ae370xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n> Content-Type: application/json\n\n\nBODY:\n\n```\n[\n saved: [\n {\n \"sender\": \"Jacque\",\n \"date\": \"2008-04-10 11:47:58-05\",\n \"text\": \"je suis un sms\"\n },\n ...\n ],\n fails: [\n ...\n ]\n\t\n]\n```\n\nRESPONSE:\n```\n\t{\n\t \"id\": 1,\n\t\t\"sender\": \"Jacque\",\n\t\t\"date\": \"2008-04-10 11:47:58-05\",\n\t\t\"text\": \"je suis un sms\"\n\t}\n```\n\n\n### PUT \n\n\n> PUT http://localhost:8000/api/sms/{id}\n\nid: id of sms\n\nHEADER needed: \n\n> Authorization: Token e0ae370xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n> Content-Type: application/json\n\nBODY:\n\n```\n\n\t{\n\t\t\"sender\": \"Jacque\",\n\t\t\"date\": \"2008-04-10 11:47:58-05\",\n\t\t\"text\": \"je suis un sms\"\n\t}\n\t\n\n```\n\nRESPONSE:\n\n```\n\n\t{\n\t \"id\": 5,\n\t\t\"sender\": \"Jacque\",\n\t\t\"date\": \"2008-04-10 11:47:58-05\",\n\t\t\"text\": \"je suis un sms\"\n\t}\n```\n\n### Delete\n\n> DELETE http://localhost:8000/api/sms/{id}\n\nid: id of sms to delete\n\nHEADER needed: \n\n> Authorization: Token e0ae370xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n> Content-Type: application/json\n\n\nRESPONSE:\n\n```\n{\"status\": \"...\"}\n```\n\n## IDENTIFICATION\n\nUse Djoser documentation to add the identification in your project:\n\n[Documention link](https://djoser.readthedocs.io/en/stable/)\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/zephirdeadline/djangoAPI_rest_object", "keywords": "", "license": "WTFPL", "maintainer": "", "maintainer_email": "", "name": "rest_object", "package_url": "https://pypi.org/project/rest_object/", "platform": "", "project_url": "https://pypi.org/project/rest_object/", "project_urls": { "Homepage": "https://github.com/zephirdeadline/djangoAPI_rest_object" }, "release_url": "https://pypi.org/project/rest_object/2.2.2/", "requires_dist": null, "requires_python": "", "summary": "Create a REST API from any model you want thank your serializer. You can decide If you want an Authorization and if your datas are linked to an account.", "version": "2.2.2" }, "last_serial": 4324756, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "262442d506a4e6acbdaec1debc9ae12a", "sha256": "f13c2c6fe1ee818c78e61097097870981adc89b41854ae8f18c61955230898a1" }, "downloads": -1, "filename": "rest_object-1.0.tar.gz", "has_sig": false, "md5_digest": "262442d506a4e6acbdaec1debc9ae12a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8249, "upload_time": "2018-04-30T00:12:44", "url": "https://files.pythonhosted.org/packages/c8/66/e25170f6d59c8da01bc56f737d079babcb3582a8879b23231e8f95306aad/rest_object-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "ebc13b96b4fc5f8bf0c878d149c8635a", "sha256": "97c4a3068db501a7ab9373cccad31f5c175410ae70af042627f31272f044544a" }, "downloads": -1, "filename": "rest_object-1.1.tar.gz", "has_sig": false, "md5_digest": "ebc13b96b4fc5f8bf0c878d149c8635a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8484, "upload_time": "2018-05-09T12:24:34", "url": "https://files.pythonhosted.org/packages/8d/b5/085bec64358e41776dec486013654b07438e4b7c069e7a254bcaf15b06c5/rest_object-1.1.tar.gz" } ], "2.1": [ { "comment_text": "", "digests": { "md5": "2db324a16ec95a864a044949f649e70d", "sha256": "4ee9aab7cd0cca57525d0af48dd2a7b4281c9e2de611e3874daeedc80af42027" }, "downloads": -1, "filename": "rest_object-2.1.tar.gz", "has_sig": false, "md5_digest": "2db324a16ec95a864a044949f649e70d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9390, "upload_time": "2018-09-27T14:15:13", "url": "https://files.pythonhosted.org/packages/18/6f/728bbe03fdfcf78bf56d50f6394d4e60dd8befbb92097b3b11f897113098/rest_object-2.1.tar.gz" } ], "2.2": [ { "comment_text": "", "digests": { "md5": "0cc2bbd5cd0c87bc6fc1f46d2c76806c", "sha256": "f8f3593e6ebfa3b1cd2dcf4fac577e3658d5463b54f14ccbe6d3ea7d28e864ec" }, "downloads": -1, "filename": "rest_object-2.2.tar.gz", "has_sig": false, "md5_digest": "0cc2bbd5cd0c87bc6fc1f46d2c76806c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7979, "upload_time": "2018-09-30T10:47:25", "url": "https://files.pythonhosted.org/packages/05/38/9d12006c87cb27d93b46170733c6fa1e22fd759845a7f6b481dc4955edd5/rest_object-2.2.tar.gz" } ], "2.2.1": [ { "comment_text": "", "digests": { "md5": "e4bde415b719a3f4cfa86d0b938be47c", "sha256": "9a394ff7e8a37734e2b67d93c43aba07c22bfa7892655aa2d73cad17480d5a45" }, "downloads": -1, "filename": "rest_object-2.2.1.tar.gz", "has_sig": false, "md5_digest": "e4bde415b719a3f4cfa86d0b938be47c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7986, "upload_time": "2018-09-30T10:57:13", "url": "https://files.pythonhosted.org/packages/cc/fe/de2f47b795a6e0aaf20123cf2fc2f67b092b7e115ac2b209a6850eb19484/rest_object-2.2.1.tar.gz" } ], "2.2.2": [ { "comment_text": "", "digests": { "md5": "c0cad979e50a24284b2e3475acb42950", "sha256": "8ab9c1b17a3e0f3f76ee388a12cdada5bec0355d57af393eb21ffdff0a9e33c4" }, "downloads": -1, "filename": "rest_object-2.2.2.tar.gz", "has_sig": false, "md5_digest": "c0cad979e50a24284b2e3475acb42950", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7971, "upload_time": "2018-09-30T10:58:05", "url": "https://files.pythonhosted.org/packages/9a/e4/19a2dc9a7498a9f61dfbc7cdf1806dc164f064261613fa5635d05f10e2d2/rest_object-2.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c0cad979e50a24284b2e3475acb42950", "sha256": "8ab9c1b17a3e0f3f76ee388a12cdada5bec0355d57af393eb21ffdff0a9e33c4" }, "downloads": -1, "filename": "rest_object-2.2.2.tar.gz", "has_sig": false, "md5_digest": "c0cad979e50a24284b2e3475acb42950", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7971, "upload_time": "2018-09-30T10:58:05", "url": "https://files.pythonhosted.org/packages/9a/e4/19a2dc9a7498a9f61dfbc7cdf1806dc164f064261613fa5635d05f10e2d2/rest_object-2.2.2.tar.gz" } ] }