All Projects â†’ Abdenasser â†’ dr_scaffold

Abdenasser / dr_scaffold

Licence: MIT license
scaffold django rest apis like a champion 🚀

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to dr scaffold

Generator Sails Rest Api
Yeoman generator for scaffolding Sails REST API with predefined features
Stars: ✭ 336 (+189.66%)
Mutual labels:  scaffold, scaffolding
Generate Gh Repo
Generate generator to create a new repository on GitHub.
Stars: ✭ 11 (-90.52%)
Mutual labels:  scaffold, scaffolding
Delon
Delon is a set of essential modules for ng-alain. https://github.com/ng-alain/ng-alain/issues
Stars: ✭ 586 (+405.17%)
Mutual labels:  scaffold, scaffolding
tfstage
TFStage: TensorFlow Project Scaffolding
Stars: ✭ 64 (-44.83%)
Mutual labels:  scaffold, scaffolding
Generate
A new command line tool and developer framework for scaffolding out GitHub projects. Generate offers the robustness and configurability of Yeoman, the expressiveness and simplicity of Slush, and more powerful flow control and composability than either.
Stars: ✭ 238 (+105.17%)
Mutual labels:  scaffold, scaffolding
Bozon
🛠 Command line tool for building, testing and publishing modern Electron applications
Stars: ✭ 687 (+492.24%)
Mutual labels:  scaffold, scaffolding
Project Name
Get the name of a project from package.json, git config, or basename of the current working directory.
Stars: ✭ 8 (-93.1%)
Mutual labels:  scaffold, scaffolding
Template Micro Service
Scaffolding out a micro-service
Stars: ✭ 12 (-89.66%)
Mutual labels:  scaffold, scaffolding
Awesome React Generator
No more clicking around to create files in your react project! Awesome React Generator is Command Line Tool that let's you scaffold your components without leaving your terminal.
Stars: ✭ 98 (-15.52%)
Mutual labels:  scaffold, command-line-tool
Larawiz
Larawiz is a easy project scaffolder for Laravel
Stars: ✭ 28 (-75.86%)
Mutual labels:  scaffold, scaffolding
Dictfier
Python library to convert/serialize class instances(Objects) both flat and nested into a dictionary data structure. It's very useful in converting Python Objects into JSON format
Stars: ✭ 67 (-42.24%)
Mutual labels:  json-api, django-rest-framework
Django Rest Framework Json Api
JSON API support for Django REST Framework
Stars: ✭ 898 (+674.14%)
Mutual labels:  json-api, django-rest-framework
react-scaffolder
âš¡ Scaffolding tool for React
Stars: ✭ 43 (-62.93%)
Mutual labels:  scaffold, scaffolding
repanier
Django extension : web tool for short circuit food supply
Stars: ✭ 18 (-84.48%)
Mutual labels:  django-rest-framework
cati
Cati Unix Package Manager
Stars: ✭ 19 (-83.62%)
Mutual labels:  command-line-tool
nuxt-modules-cli
Browse Nuxt.js modules from the terminal
Stars: ✭ 25 (-78.45%)
Mutual labels:  command-line-tool
choo-cli
Command line scaffolding tools for choo
Stars: ✭ 65 (-43.97%)
Mutual labels:  scaffold
cybr-cli
A "Swiss Army Knife" command-line interface (CLI) for easy human and non-human interaction with @cyberark suite of products.
Stars: ✭ 45 (-61.21%)
Mutual labels:  command-line-tool
generator-stencil
Scaffolding tool 🔨 for Stencil js applications
Stars: ✭ 16 (-86.21%)
Mutual labels:  scaffolding
hydra
A command-line utility for generating language-specific project structure.
Stars: ✭ 18 (-84.48%)
Mutual labels:  command-line-tool

dr_scaffold blueprint icon

dr_scaffold

Scaffold django rest apis like a champion âš¡. said no one before

Tweet

Overview

This library will help you to scaffold full Restful API Resources in seconds using only one command:

$ python manage.py dr_scaffold blog Post body:textfield author:foreignkey:Author
  • models.py with Models and fields generated by the CLI âš¡

  • admin.py with Models registered and ready âš¡

  • views.py with appropriate ViewSets readyâš¡

  • urls.py with appropriate URLs ready.âš¡

  • serializers.py with Model Serializers ready âš¡

  • and more ...

Installation and usage

For a detailed guide read scaffold django apis like a champion, this library assumes that you have Django Rest Framework. if not, please refer to this guide.

Install dr_scaffold package :

$ pip install dr-scaffold

Add dr_scaffold to your INSTALLED_APPS like this:

INSTALLED_APPS = [
    ...
    'dr_scaffold'
]

Add CORE_FOLDER and API_FOLDER to your settings.py (optional):

CORE_FOLDER = "core_dir/"
API_FOLDER = "api_dir/"

Run your scaffolds like this:

$ python manage.py dr_scaffold blog Post body:textfield author:foreignkey:Author

Generate tests

We support generating tests for your models and apis, you can generate tests by adding --tests to your command like follow:

$ python manage.py dr_scaffold blog Author name:charfield --tests

This 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.

Also bare in mind that you should run your migrations before running the tests

Generate ViewSet Mixins

We support two types of ViewSets, we support ModelViewSet and we support ViewSets with Mixins.

  • ModelViewSets are the default that get generated with the dr_scaffold command
  • To generate a view with Mixins pass a value of what mixins you want to include like --mixins CRUD this will result in a view with the Create, List, Retrieve, Update, Destroy actions.

Let's generate an API that does only support the Create and Read methods (Read is both list and retrieve):

$ python manage.py dr_scaffold blog Author name:charfield --mixins CR

The command will generate an Author API with a ViewSet like the following:

class AuthorViewSet(
    mixins.CreateModelMixin,
    mixins.ListModelMixin,
    mixins.RetrieveModelMixin,
    viewsets.GenericViewSet
):
    queryset = Author.objects.all()
    serializer_class = AuthorSerializer
    #permission_classes = (permissions.IsAuthenticated,)

    def get_queryset(self):
        #user = self.request.user
        queryset = Author.objects.all()
        #insert specific queryset logic here
        return queryset

    def get_object(self):
        #insert specific get_object logic here
        return super().get_object()

    def create(self, request, *args, **kwargs):
        serializer = AuthorSerializer(data=request.data)
        serializer.is_valid(raise_exception=True)
        serializer.save()
        return Response(serializer.data)

    def list(self, request, *args, **kwargs):
        queryset = self.get_queryset()
        serializer = AuthorSerializer(queryset, many=True)
        return Response(serializer.data)

    def retrieve(self, request, *args, **kwargs):
        instance = self.get_object()
        serializer = AuthorSerializer(instance=instance)
        return Response(serializer.data)

Supported field types

We support most of django field types.

Contributors

This project exists thanks to all the people who contribute. [Contribute]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].