{"id":13678526,"url":"https://github.com/Abdenasser/dr_scaffold","last_synced_at":"2025-04-29T15:31:40.971Z","repository":{"id":39762115,"uuid":"398059974","full_name":"Abdenasser/dr_scaffold","owner":"Abdenasser","description":"scaffold django rest apis like a champion 🚀","archived":false,"fork":false,"pushed_at":"2023-10-02T23:49:26.000Z","size":16300,"stargazers_count":158,"open_issues_count":0,"forks_count":15,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-11-08T11:55:46.859Z","etag":null,"topics":["apps","command-line-tool","django","django-rest-framework","generator","hacktoberfest","json-api","python","rest-api","scaffold","scaffolding","web"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Abdenasser.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"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}},"created_at":"2021-08-19T19:57:43.000Z","updated_at":"2024-08-27T01:06:50.000Z","dependencies_parsed_at":"2024-01-14T15:23:27.622Z","dependency_job_id":"831924ba-4838-41f2-8ac7-ab68db5d9f9a","html_url":"https://github.com/Abdenasser/dr_scaffold","commit_stats":{"total_commits":217,"total_committers":9,"mean_commits":24.11111111111111,"dds":"0.13824884792626724","last_synced_commit":"2dbec413c7047a23a8b6028876a2be2ad42d5f01"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdenasser%2Fdr_scaffold","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdenasser%2Fdr_scaffold/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdenasser%2Fdr_scaffold/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdenasser%2Fdr_scaffold/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Abdenasser","download_url":"https://codeload.github.com/Abdenasser/dr_scaffold/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224178902,"owners_count":17268967,"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":["apps","command-line-tool","django","django-rest-framework","generator","hacktoberfest","json-api","python","rest-api","scaffold","scaffolding","web"],"created_at":"2024-08-02T13:00:54.596Z","updated_at":"2024-11-11T21:30:31.241Z","avatar_url":"https://github.com/Abdenasser.png","language":"Python","funding_links":[],"categories":["Uncategorized","Python"],"sub_categories":["Uncategorized"],"readme":"\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/Abdenasser/dr_scaffold\"\u003e\u003cimg src=\"https://ph-files.imgix.net/99f3cc0a-58b1-4c16-bb41-1963b0a692fc.png\" alt=\"dr_scaffold blueprint icon\" height=\"80\"/\u003e\u003c/a\u003e\u003c/p\u003e\n\u003ch1 align=\"center\"\u003edr_scaffold\u003c/h1\u003e\n\u003cp align=\"center\"\u003eScaffold django rest apis like a champion ⚡. said no one before\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://codecov.io/gh/Abdenasser/dr_scaffold\"\u003e\u003cimg src=\"https://codecov.io/gh/Abdenasser/dr_scaffold/branch/main/graph/badge.svg?token=VLUZWSTJV2\"/\u003e\u003c/a\u003e \u003ca href=\"https://app.travis-ci.com/Abdenasser/dr_scaffold\"\u003e\u003cimg src=\"https://app.travis-ci.com/Abdenasser/dr_scaffold.svg?branch=main\"/\u003e\u003c/a\u003e \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg src=\"https://img.shields.io/pypi/l/ansicolortags.svg\"/\u003e\u003c/a\u003e \u003ca href=\"https://pypi.org/project/dr-scaffold/\"\u003e\u003cimg src=\"https://d25lcipzij17d.cloudfront.net/badge.svg?id=py\u0026r=r\u0026type=6e\u0026v=2.1.2\u0026x2=0\"/\u003e\u003c/a\u003e \u003ca href=\"https://pepy.tech/project/dr-scaffold\"\u003e\u003cimg src=\"https://pepy.tech/badge/dr-scaffold\"/\u003e\u003c/a\u003e \u003ca href=\"https://twitter.com/intent/tweet?text=Scaffold django rest apis like a champion ⚡. said no one before.\u0026url=https://github.com/Abdenasser/dr_scaffold\u0026hashtags=python,opensource,django,api,developers\"\u003e\u003cimg src=\"http://randojs.com/images/tweetShield.svg\" alt=\"Tweet\" height=\"20\"/\u003e\u003c/a\u003e\n\n\u003c/p\u003e\n\n# Overview\n\nThis library will help you to scaffold full **Restful API Resources** in seconds using only one command:\n\n```console\n$ python manage.py dr_scaffold blog Post body:textfield author:foreignkey:Author\n```\n\n- `models.py` with Models and fields generated by the CLI ⚡\n- `admin.py` with Models registered and ready ⚡\n- `views.py` with appropriate ViewSets ready⚡\n- `urls.py` with appropriate URLs ready.⚡\n- `serializers.py` with Model Serializers ready ⚡\n\n- and more ...\n\n# Installation and usage\n\n\u003e For a detailed guide read [scaffold django apis like a champion](https://www.abdenasser.com/2021/08/25/scaffold-django-apis-like-a-champion/), this library assumes that you have **Django Rest Framework**. if not, please refer to [this guide](https://www.django-rest-framework.org/#installation).\n\n#### Install dr_scaffold package :\n\n```console\n$ pip install dr-scaffold\n```\n\n#### Add dr_scaffold to your INSTALLED_APPS like this:\n\n```python\nINSTALLED_APPS = [\n    ...\n    'dr_scaffold'\n]\n```\n\n#### Add CORE_FOLDER and API_FOLDER to your settings.py (optional):\n\n```python\nCORE_FOLDER = \"core_dir/\"\nAPI_FOLDER = \"api_dir/\"\n```\n\n#### Run your scaffolds like this:\n\n```console\n$ python manage.py dr_scaffold blog Post body:textfield author:foreignkey:Author\n```\n\n# Generate tests\n\nWe support generating tests for your models and apis, you can generate tests by adding `--tests` to your command like follow:\n\n```console\n$ python manage.py dr_scaffold blog Author name:charfield --tests\n```\n\nThis will generate factories for your models and their tests (ViewSets tests will be added soon), we depend on `pytest` and `factory_boy` so you should have them installed in order to run your tests.\n\nAlso bare in mind that you should run your migrations before running the tests\n\n# Generate ViewSet Mixins\n\nWe support two types of ViewSets, we support **ModelViewSet** and we\nsupport **ViewSets** with Mixins.\n\n- ModelViewSets are the default that get generated with the\n  dr_scaffold command\n- To generate a view with Mixins pass a value of what mixins you want\n  to include like `--mixins CRUD` this will result in a view with the\n  Create, List, Retrieve, Update, Destroy actions.\n\nLet's generate an API that does only support the **Create** and **Read**\nmethods (Read is both list and retrieve):\n\n```console\n$ python manage.py dr_scaffold blog Author name:charfield --mixins CR\n```\n\nThe command will generate an Author API with a ViewSet like the\nfollowing:\n\n```python\nclass AuthorViewSet(\n    mixins.CreateModelMixin,\n    mixins.ListModelMixin,\n    mixins.RetrieveModelMixin,\n    viewsets.GenericViewSet\n):\n    queryset = Author.objects.all()\n    serializer_class = AuthorSerializer\n    #permission_classes = (permissions.IsAuthenticated,)\n\n    def get_queryset(self):\n        #user = self.request.user\n        queryset = Author.objects.all()\n        #insert specific queryset logic here\n        return queryset\n\n    def get_object(self):\n        #insert specific get_object logic here\n        return super().get_object()\n\n    def create(self, request, *args, **kwargs):\n        serializer = AuthorSerializer(data=request.data)\n        serializer.is_valid(raise_exception=True)\n        serializer.save()\n        return Response(serializer.data)\n\n    def list(self, request, *args, **kwargs):\n        queryset = self.get_queryset()\n        serializer = AuthorSerializer(queryset, many=True)\n        return Response(serializer.data)\n\n    def retrieve(self, request, *args, **kwargs):\n        instance = self.get_object()\n        serializer = AuthorSerializer(instance=instance)\n        return Response(serializer.data)\n```\n\n# Supported field types\n\nWe support most of django field types.\n\n# Contributors\n\nThis project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]\n\n\u003ca href=\"https://github.com/Abdenasser/dr_scaffold/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=Abdenasser/dr_scaffold\" /\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAbdenasser%2Fdr_scaffold","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAbdenasser%2Fdr_scaffold","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAbdenasser%2Fdr_scaffold/lists"}