{ "info": { "author": "Evans Murithi", "author_email": "murithievans80@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.11", "Framework :: Django :: 2.0", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP" ], "description": "REST framework files\n====================\n\n|build-status-image| |coverage-status-image|\n\n**File download and upload support for Django REST framework.**\n\n--------------\n\nOverview\n========\n\nREST framework files allows you to download a file in the format used to\nrender the response and also allows creation of model instances by\nuploading a file containing the model fields.\n\nRequirements\n============\n\n- Python (2.7, 3.5, 3.6)\n- Django REST framework (3.4, 3.5, 3.6, 3.7, 3.8)\n\nInstallation\n============\n\nInstall using ``pip``:\n\n::\n\n pip install djangorestframework-files\n\nExample\n=======\n\n*models.py*\n\n.. code:: python\n\n from django.db import models\n\n class ABC(models.Model):\n name = models.CharField(max_length=255)\n\n*serializers.py*\n\n.. code:: python\n\n from rest_framework import serializers\n\n from .models import ABC\n\n class ABCSerializer(serializers.ModelSerializer):\n class Meta:\n model = ABC\n fields = '__all__'\n\n*views.py*\n\n.. code:: python\n\n from rest_framework.parsers import JSONParser, MultiPartParser\n from rest_framework_files.viewsets import ImportExportModelViewSet\n\n from .models import ABC\n from .serializers import ABCSerializer\n\n class ABCViewSet(ImportExportModelViewSet):\n queryset = ABC.objects.all()\n serializer_class = ABCSerializer\n # if filename is not provided, the view name will be used as the filename\n filename = 'ABC'\n # renderer classes used to render your content. will determine the file type of the download\n renderer_classes = (JSONParser, )\n parser_classes = (MultiPartParser, )\n # parser classes used to parse the content of the uploaded file\n file_content_parser_classes = (JSONParser, )\n\nSome third party packages that offer media type support:\n\n- `Parsers `__\n- `Renderers `__\n\n*urls.py*\n\n.. code:: python\n\n from rest_framework import routers\n\n from .views import ABCViewSet\n\n router = routers.ImportExportRouter()\n router.register(r'abc', ABCViewSet)\n\n urlpatterns = router.urls\n\nDownloading\n-----------\n\nTo download a ``json`` file you can go to the url ``/abc/?format=json``.\nThe ``format`` query parameter specifies the media type you want your\nresponse represented in. To download an ``xml`` file, your url would be\n``/abc/?format=xml``. For this to work, make sure you have the\nrespective ``renderers`` to render your response.\n\nUploading\n---------\n\nTo create model instances from a file, upload a file to the url\n``/abc/``. Make sure the content of the file can be parsed by the\nparsers specified in the ``file_content_parser_classes`` or else it will\nreturn a ``HTTP_415_UNSUPPORTED_MEDIA_TYPE`` error.\n\nFor sample file examples you can upload, check the `assets\nfolder `__\n\nFor more examples on how to use the viewsets or generic views, check the\n`test\napplication `__\n\n.. |build-status-image| image:: https://travis-ci.org/evansmurithi/django-rest-framework-files.svg?branch=master\n :target: https://travis-ci.org/evansmurithi/django-rest-framework-files\n.. |coverage-status-image| image:: https://codecov.io/gh/evansmurithi/django-rest-framework-files/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/evansmurithi/django-rest-framework-files\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/evansmurithi/django-rest-framework-files", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "djangorestframework-files", "package_url": "https://pypi.org/project/djangorestframework-files/", "platform": "", "project_url": "https://pypi.org/project/djangorestframework-files/", "project_urls": { "Homepage": "https://github.com/evansmurithi/django-rest-framework-files" }, "release_url": "https://pypi.org/project/djangorestframework-files/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "File download and upload support for Django REST framework", "version": "1.1.0" }, "last_serial": 3869624, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "eefcbc7b6fb262e881e40e1e5c4ed17e", "sha256": "b4a325e59a9c755728589ca70642eca463ea2c30e34a97cdb94936577979a75a" }, "downloads": -1, "filename": "djangorestframework_files-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "eefcbc7b6fb262e881e40e1e5c4ed17e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7584, "upload_time": "2017-05-20T20:37:54", "url": "https://files.pythonhosted.org/packages/07/58/fe94d8d0a4496675d33a96d43cd92540855f701b5603677c636f67b6cf77/djangorestframework_files-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4b56760cc3891e343735ab6128c22fcc", "sha256": "76a031917f01d31585733a874e8a83ce3702935bdd5f9e5e99b12f66092353d9" }, "downloads": -1, "filename": "djangorestframework-files-1.0.1.tar.gz", "has_sig": false, "md5_digest": "4b56760cc3891e343735ab6128c22fcc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5467, "upload_time": "2017-05-20T20:37:57", "url": "https://files.pythonhosted.org/packages/b8/03/d43ba2437d1c37f7e6d1ee7952f1845ec103ef6950f021ed180170c54ecd/djangorestframework-files-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "466dab759a1b7062cdac5c03bd4b2095", "sha256": "e327371d019077162024f994c8d0d14c046109191a59b8716a3336bb11db4a93" }, "downloads": -1, "filename": "djangorestframework-files-1.1.0.tar.gz", "has_sig": false, "md5_digest": "466dab759a1b7062cdac5c03bd4b2095", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5446, "upload_time": "2018-05-16T18:10:02", "url": "https://files.pythonhosted.org/packages/a8/21/1e2bb47a377c5f0d8c90e7c560cd2f5a29cac325b061c2375e0ea494f82d/djangorestframework-files-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "466dab759a1b7062cdac5c03bd4b2095", "sha256": "e327371d019077162024f994c8d0d14c046109191a59b8716a3336bb11db4a93" }, "downloads": -1, "filename": "djangorestframework-files-1.1.0.tar.gz", "has_sig": false, "md5_digest": "466dab759a1b7062cdac5c03bd4b2095", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5446, "upload_time": "2018-05-16T18:10:02", "url": "https://files.pythonhosted.org/packages/a8/21/1e2bb47a377c5f0d8c90e7c560cd2f5a29cac325b061c2375e0ea494f82d/djangorestframework-files-1.1.0.tar.gz" } ] }