Django Simplify


Django simplify provides Ruby on Rails-like command line functionalities, models and helper functions so you can focus on development and removes the pain of repeating frequent actions.



django-simplify can be installed via pip.

$ pip install django-simplify

Then just add simplify to your INSTALLED_APPS.

Below are several example commands you can run.

$ python create_app <app_name>


Helper models


from simplify.helpers.model_helper import TimeBasedModel, NamedTimeBasedModel

class MyModel(TimeBasedModel):
    extra_fields = ....
from simplify.helpers.admin_helper import AlphaNumericFilterAdmin

class MemberAdmin(AlphaNumericFilterAdmin):
    alphanumeric_filter = ["first_name", "last_name", 'age'] # this part is what creates the filter
    list_filter = ['age']
    list_display = ['first_name', 'last_name',]

Management commands

1. create_app


$ python create_app <app_name>

2. create_model

Creates a model and their respective fields. the following types maps to respective Django model fields. It will also add the app to the django admin too.


$ python create_app <app_name> <model_name> field_name:type field_name:type ... 

an example

$ python create_app member Member first_name:text last_name:text age:int

will generate the following code in the member/ file

class Member(TimeBasedModel):
    first_name = models.CharField(max_length=50)
    last_name = models.CharField(max_length=50)
    age = models.IntegerField(default=0)

    def __str__(self):
        return self.first_name

note The command uses the first specified field as the __str__ default.

Specifying relationships

Specifying ForeignKey, OneToOneField or ManyToManyField is quite easy. just add an =<related_model>. See example

$ python create_app <app_name> <model_name> field_name:type=related_model

if the related model is in the same file, specify it as app_name.Model

$ python create_app author Author name:char books:fk=Book # or   
$ python create_app author Author name:char books:fk=author.Book 

if in a different app. (say book model), obviously you should be able to substitute fk with m2m, o2o, 121

$ python create_app author Author name:char books:fk=book.Book 

will create the following

class Author(TimeBasedModel):
    name = models.CharField(max_length=50)
    books = models.ForeignKey('book.Book', on_delete=models.CASCADE)

    def __str__(self):

3. create_view

Creates a view, generate its respective template and adds the path in the file


$ python create_view <app_name> <view_name> 


$ python create_view member MemberDetail


Note: This is still in early development mode. might have bugs. It works fine if you write good code and follow the django style of development. Please fork the project to make contributions


I'd like to say a big thank you to God without which this wouldn't be possible. I would also like to say thanks to everyone who has and will contribute to this in the future.