{"id":14483305,"url":"https://github.com/rewritten/django-restful","last_synced_at":"2025-08-30T04:30:29.486Z","repository":{"id":1392843,"uuid":"1384505","full_name":"rewritten/django-restful","owner":"rewritten","description":"A set of classes to implement a RESTful interface over a Django site","archived":false,"fork":false,"pushed_at":"2011-02-22T23:58:38.000Z","size":107,"stargazers_count":9,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-27T04:32:20.196Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rewritten.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-02-18T22:38:41.000Z","updated_at":"2019-08-13T14:41:55.000Z","dependencies_parsed_at":"2022-07-29T12:49:02.022Z","dependency_job_id":null,"html_url":"https://github.com/rewritten/django-restful","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rewritten/django-restful","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewritten%2Fdjango-restful","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewritten%2Fdjango-restful/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewritten%2Fdjango-restful/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewritten%2Fdjango-restful/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rewritten","download_url":"https://codeload.github.com/rewritten/django-restful/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rewritten%2Fdjango-restful/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272805292,"owners_count":24995909,"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","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-09-03T00:01:41.142Z","updated_at":"2025-08-30T04:30:29.210Z","avatar_url":"https://github.com/rewritten.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"DJANGO-RESTFUL\n==============\n\n\nA set of class-based views, mixins and utilities, which will transparently\nmanage serialization, deserialization and other aspects of RESTful resources\nbased off a Django site's models.\n\nThe views are based off Django 1.3 Class-Based-Views, so Django 1.3 is needed\nor a backport of the relevant classes.\n\nSee the documentation for in-depth description of the available options.\n\nWhy another Restful lib\n-----------------------\n\nI used to use piston for a number of projects, and I found a couple of\nlimitations it its architecture, and other aprts I didn't need at all.\n\nOn the other side, Django 1.3 introduces class-based views, and they seem\nto be a more natural candidate to base a restful interface upon. \nWith CBVs, one can cut into any point of the request process, and change\nthe behavior.\n\nAs an example, in piston it's not possible to use a ValuesQuerySet in a read-object\nrequest, only in read-collection. With our approach, a subclass may\noverride ``get_query_set()`` and still have it applied when getting\na single object.\n\n\n\nViews\n-----\n\nThe RestfulResource class is a generic view, so it can be used as-is in your\nurlconf module:\n\n::\n\n    urlpatterns = patterns('',\n        ('^users(/(?P\u003cpk\u003e\\d+))?(?P\u003cformat\u003e\\.\\w+)?,\n            RestfulResource.as_view(model=User)\n        ),\n        ('^posts(/(?P\u003cslug\u003e\\d+))?(?P\u003cformat\u003e\\.\\w+)?,\n            RestfulResource.as_view(model=Post)\n        ),\n        ...\n    )\n\nOf course the power of these views resides in the ability to subclass them,\nand to reuse the pieces to build limited-scope versions (e.g. let XML out)\n\n\nGET requests\n------------\n\nThe format for response serialization is taken from the ``format`` kwarg of\nthe view, as configured in the url module. It can optionally start with a\nsingle dot, which is ignored.\n\nThe choice beween collection and item representation is done like in Django\nClass-Based-Views: if there is a kwarg ``pk`` or ``slug`` and it is not \n``None``, then the corresponding item is retrieved, else the collection, \nusing the provided queryset and optional filters.\n\nFilters can be extracted from the GET parameters, using a list of \n``LookupParameter`` instances in the ``get_lookups`` or ``kwargs_lookups`` \nclass attribute.\n\nFields for serialization can be defined once for all or depending on a\nspecial GET parameter, which will select among a set of predefined choices.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frewritten%2Fdjango-restful","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frewritten%2Fdjango-restful","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frewritten%2Fdjango-restful/lists"}