{ "info": { "author": "Alan Justino and Oscar Vilaplana", "author_email": "alan.justino@yahoo.com.br, dev@oscarvilaplana.cat", "bugtrack_url": null, "classifiers": [], "description": "**This is a work in progress. It \"works for me\" at www.apiregistro.com.br, \nbut I cannot warranty that it fully \"works everywhere\" yet.**\n\ndrf-nested-routers\n=====================\n\nThis package provides routers and relations to create nested resources in the [Django Rest Framework](http://django-rest-framework.org/)\n\nNested resources are needed for full REST URL structure, if one resource lives inside another.\n\nThe following example is about Domains and DNS Nameservers. \nThere are many domains, and each domain has many nameservers. The \"nameserver\" resource does not\nexist without a domain, so you need it \"nested\" inside the domain.\n\nInstallation\n------------\n\nYou can install this library using pip:\n\n```pip install drf-nested-routers```\n\nQuickstart\n----------\n\nThe desired URL signatures are:\n```\n\\domain\\ <- Domains list\n\\domain\\{pk}\\ <- One domain, from {pk]\n\\domain\\{domain_pk}\\nameservers\\ <- Nameservers of domain from {domain_pk}\n\\domain\\{domain_pk}\\nameservers\\{pk} <- Specific nameserver from {pk}, of domain from {domain_pk}\n```\n\nHow to do it (example):\n```python\n# urls.py\nfrom rest_framework_nested import routers\nfrom views import DomainViewSet, NameserverViewSet\n(...)\n\nrouter = routers.SimpleRouter()\nrouter.register(r'domains', DomainViewSet)\n\ndomains_router = routers.NestedSimpleRouter(router, r'domains', lookup='domain')\ndomains_router.register(r'nameservers', NameserverViewSet)\n\nurlpatterns = patterns('',\n url(r'^', include(router.urls)),\n url(r'^', include(domains_router.urls)),\n)\n```\n```python\n# views.py\nclass NameserverViewSet(viewsets.ViewSet):\n def list(self, request, domain_pk=None):\n nameservers = self.queryset.filter(domain=domain_pk)\n (...)\n return Response([...])\n\n def retrieve(self, request, pk=None, domain_pk=None):\n nameservers = self.queryset.get(pk=pk, domain=domain_pk)\n (...)\n return Response(serializer.data)\n```\n\nLicense\n=======\n\nThis package is licensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\nand can undestand more at http://choosealicense.com/licenses/apache/ on the\nsidebar notes.\n\nApache Licence v2.0 is a MIT-like licence. This means, in plain English:\n- Its trully open source\n- You can use it as you wish, for money or not\n- You can sublicence it (change the licence!!)\n- This way, you can even use it on your closed-source project\nAs long as:\n- You cannot use the authors name, logos, etc, to endorse a project\n- You keep the authors copyright notices where this code got used, even on your closed-source project\n(come on, even Microsoft kept BSD notices on Windows about its TCP/IP stack :P)", "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/alanjds/drf-nested-routers", "keywords": null, "license": "Apache", "maintainer": null, "maintainer_email": null, "name": "rest-framework-nested", "package_url": "https://pypi.org/project/rest-framework-nested/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/rest-framework-nested/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/alanjds/drf-nested-routers" }, "release_url": "https://pypi.org/project/rest-framework-nested/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Nested resources for the Django Rest Framework", "version": "0.1.0" }, "last_serial": 1270092, "releases": { "0.1.0": [] }, "urls": [] }