{"id":13469302,"url":"https://github.com/jpadilla/django-rest-framework-xml","last_synced_at":"2025-04-04T22:05:25.410Z","repository":{"id":23856182,"uuid":"27234185","full_name":"jpadilla/django-rest-framework-xml","owner":"jpadilla","description":"XML support for Django REST Framework","archived":false,"fork":false,"pushed_at":"2023-09-18T07:22:39.000Z","size":1161,"stargazers_count":86,"open_issues_count":25,"forks_count":59,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-12T07:26:15.607Z","etag":null,"topics":["django","django-rest-framework","python"],"latest_commit_sha":null,"homepage":"http://jpadilla.github.io/django-rest-framework-xml","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jpadilla.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["jpadilla"]}},"created_at":"2014-11-27T16:52:02.000Z","updated_at":"2024-09-11T12:32:31.000Z","dependencies_parsed_at":"2024-01-07T18:29:13.459Z","dependency_job_id":null,"html_url":"https://github.com/jpadilla/django-rest-framework-xml","commit_stats":{"total_commits":62,"total_committers":8,"mean_commits":7.75,"dds":0.5483870967741935,"last_synced_commit":"da33b6bd54e8e434a8218034f41678ec9d4a826e"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpadilla%2Fdjango-rest-framework-xml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpadilla%2Fdjango-rest-framework-xml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpadilla%2Fdjango-rest-framework-xml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpadilla%2Fdjango-rest-framework-xml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpadilla","download_url":"https://codeload.github.com/jpadilla/django-rest-framework-xml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256110,"owners_count":20909240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","django-rest-framework","python"],"created_at":"2024-07-31T15:01:32.468Z","updated_at":"2025-04-04T22:05:25.396Z","avatar_url":"https://github.com/jpadilla.png","language":"Python","funding_links":["https://github.com/sponsors/jpadilla"],"categories":["Python","Packages"],"sub_categories":["Renderers and Parsers"],"readme":"# REST Framework XML\n\n[![build-status-image]][github-action]\n[![pypi-version]][pypi]\n\n**XML support for Django REST Framework**\n\nFull documentation for the project is available at [http://jpadilla.github.io/django-rest-framework-xml][docs].\n\n## Overview\n\nXML support extracted as a third party package directly from the official Django REST Framework implementation. It requires the [defusedxml][defusedxml] package only because it safeguards against some security issues that were discovered.\n\n**Note**: XML output provided is an ad-hoc format that isn't formally described. If you have specific XML requirements you'll need to write your own XML parsers/renderers in order to fully control the representation.\n\n## Requirements\n\n* Python 3.5+\n* Django 2.2+\n* Django REST Framework 3.11+\n\n## Installation\n\nInstall using `pip`...\n\n```bash\n$ pip install djangorestframework-xml\n```\n\n## Example\n\n```python\nREST_FRAMEWORK = {\n    'DEFAULT_PARSER_CLASSES': (\n        'rest_framework_xml.parsers.XMLParser',\n    ),\n    'DEFAULT_RENDERER_CLASSES': (\n        'rest_framework_xml.renderers.XMLRenderer',\n    ),\n}\n```\n\nYou can also set the renderer and parser used for an individual view, or viewset, using the APIView class based views.\n\n```python\nfrom rest_framework import routers, serializers, viewsets\nfrom rest_framework_xml.parsers import XMLParser\nfrom rest_framework_xml.renderers import XMLRenderer\n\n\nclass UserSerializer(serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = User\n        fields = ('url', 'username', 'email', 'is_staff')\n\n\nclass UserViewSet(viewsets.ModelViewSet):\n    queryset = User.objects.all()\n    serializer_class = UserSerializer\n    parser_classes = (XMLParser,)\n    renderer_classes = (XMLRenderer,)\n```\n\n### Sample output\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003croot\u003e\n    \u003clist-item\u003e\n        \u003curl\u003ehttp://127.0.0.1:8000/users/1/.xml\u003c/url\u003e\n        \u003cusername\u003ejpadilla\u003c/username\u003e\n        \u003cemail\u003ejpadilla@example.com\u003c/email\u003e\n        \u003cis_staff\u003eTrue\u003c/is_staff\u003e\n    \u003c/list-item\u003e\n\u003c/root\u003e\n```\n\n## Documentation \u0026 Support\n\nFull documentation for the project is available at [http://jpadilla.github.io/django-rest-framework-xml][docs].\n\nYou may also want to follow the [author][jpadilla] on Twitter.\n\n\n[build-status-image]: https://github.com/jpadilla/django-rest-framework-xml/workflows/CI/badge.svg\n[github-action]: https://github.com/jpadilla/django-rest-framework-xml/actions?query=workflow%3ACI\n[pypi-version]: https://img.shields.io/pypi/v/djangorestframework-xml.svg\n[pypi]: https://pypi.python.org/pypi/djangorestframework-xml\n[defusedxml]: https://pypi.python.org/pypi/defusedxml\n[docs]: http://jpadilla.github.io/django-rest-framework-xml\n[jpadilla]: https://twitter.com/jpadilla_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpadilla%2Fdjango-rest-framework-xml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpadilla%2Fdjango-rest-framework-xml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpadilla%2Fdjango-rest-framework-xml/lists"}