All Projects → Nekmo → django-code-generator

Nekmo / django-code-generator

Licence: MIT license
Generate code from your Django models for faster development

Programming Languages

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

Projects that are alternatives of or similar to django-code-generator

Toolkit
Collection of useful patterns
Stars: ✭ 137 (+291.43%)
Mutual labels:  code-generator, code-generation
Swiftcolorgen
A tool that generate code for Swift projects, designed to improve the maintainability of UIColors
Stars: ✭ 152 (+334.29%)
Mutual labels:  code-generator, code-generation
Php Code Generator
PHP code generator library
Stars: ✭ 141 (+302.86%)
Mutual labels:  code-generator, code-generation
Mid
mid is a generic domain-specific language for generating code and documentation
Stars: ✭ 68 (+94.29%)
Mutual labels:  code-generator, code-generation
regen
Easy C++ reflection and code generation
Stars: ✭ 29 (-17.14%)
Mutual labels:  code-generator, code-generation
Goreuse
Generic Code for Go
Stars: ✭ 93 (+165.71%)
Mutual labels:  code-generator, code-generation
Xcassetpacker
A command line tool for converting a folder of images into an .xcasset package for Xcode
Stars: ✭ 150 (+328.57%)
Mutual labels:  code-generator, code-generation
Laravel Code Generator
An intelligent code generator for Laravel framework that will save you time! This awesome tool will help you generate resources like views, controllers, routes, migrations, languages and/or form-requests! It is extremely flexible and customizable to cover many on the use cases. It is shipped with cross-browsers compatible template, along with a client-side validation to modernize your application.
Stars: ✭ 485 (+1285.71%)
Mutual labels:  code-generator, code-generation
evon
Fast and versatile event dispatcher code generator for Golang
Stars: ✭ 15 (-57.14%)
Mutual labels:  code-generator, code-generation
Evolutility Ui Jquery
Model-driven Web UI for CRUD using REST or localStorage.
Stars: ✭ 164 (+368.57%)
Mutual labels:  code-generator, code-generation
Scala Db Codegen
Scala code/boilerplate generator from a db schema
Stars: ✭ 49 (+40%)
Mutual labels:  code-generator, code-generation
WebApiToTypeScript
A tool for code generating TypeScript endpoints for your ASP.NET Web API controllers
Stars: ✭ 26 (-25.71%)
Mutual labels:  code-generator, code-generation
Dogen
Reference implementation of the MASD Code Generator.
Stars: ✭ 44 (+25.71%)
Mutual labels:  code-generator, code-generation
Geco
Simple code generator based on a console project, running on .Net core and using C# interpolated strings
Stars: ✭ 97 (+177.14%)
Mutual labels:  code-generator, code-generation
Colfer
binary serialization format
Stars: ✭ 597 (+1605.71%)
Mutual labels:  code-generator, code-generation
Dbcc
CAN DBC to C (and CSV, JSON and XML) compiler using the mpc parser combinator library
Stars: ✭ 142 (+305.71%)
Mutual labels:  code-generator, code-generation
Javaparser
Java 1-15 Parser and Abstract Syntax Tree for Java, including preview features to Java 13
Stars: ✭ 3,972 (+11248.57%)
Mutual labels:  code-generator, code-generation
Codemaker
A idea-plugin for Java/Scala, support custom code template.
Stars: ✭ 440 (+1157.14%)
Mutual labels:  code-generator, code-generation
Jennifer
Jennifer is a code generator for Go
Stars: ✭ 2,257 (+6348.57%)
Mutual labels:  code-generator, code-generation
celerio
Celerio is a code generator tool for data-driven application.
Stars: ✭ 73 (+108.57%)
Mutual labels:  code-generator, code-generation

django-code-generator

Latest Publish CI build status Latest PyPI version Python versions Code Climate Test coverage Requirements Status

Generate code from Django models for faster development. This project can generate a Django Rest Framework API or an admin for your app. You can also create your own templates so you can generate code for whatever you want.

To install django-code-generator, run this command in your terminal:

$ sudo pip install django-code-generator

This is the preferred method to install django-code-generator, as it will always install the most recent stable release. More info in the documentation

Then add it to your INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    'django_code_generator',
]

Usage

Generating code is as easy as:

$ python manage.py generator <template> <project app>

This project includes two default templates: admin and api. For example:

$ python manage.py generator admin myapp

Read the documentation for more info.

Create templates

A template is a directory with files that will be copied to the final path in your app. Template files can use Django Templates Syntax. When templates are generated, the app models are available to be used with the django template syntax.

For example if you create the template mytemplate you can use it for your app myapp with the command:

$ python manage.py generate mytemplate myapp

A template file example:

{% load code_generator_tags %}from django.contrib import admin
{% from_module_import app.name|add:'.models' models %}{% comment %}
{% endcomment %}
{% for model in models %}

@admin.register({{ model.name }})
class {{ model.name }}Admin(admin.ModelAdmin):
    """
    """
    list_display = (
        {% indent_items model.filter_field_names 8 quote='simple' %}
    )
    search_fields = (
        {% indent_items model.char_field_names 8 quote='simple' %}
    )
    {% if model.foreign_field_names %}autocomplete_fields = (
        {% indent_items model.foreign_field_names 8 quote='simple' %}
    ){% endif %}{% endfor %}

For more information see the docs.

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