Skip to content

django-model-api is a python library which can be used in your project for creating automatic api by just creating the models. For for info read README.me.

Notifications You must be signed in to change notification settings

kumar-sanchay/django-easy-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-easy-api

Now there is no need to create apis for common CRUD operation for any model. By using django-easy-api its really easy. Kindly follow the below steps for including this library into your project.

  1. Create Your django project.

  2. Install the app

pip install django-model-api
  1. Add easy_api in settings.py
INSTALLED_APPS = [
	.
	.
	.
	'easy_api'
]
  1. Create your django app

  2. Now in models.py follow create your model by inheriting EasyAPI model from easy_api app.

from django.db import models
from easy_api.models import EasyAPI

class MyModel(EasyAPI):
	# Your Requried field here.
  1. Migrate your models.

  2. This is the last step. You need to add this model in your app's urls.py

from django.urls import path
from .models import MyModel

urlpatterns = [
	path('myurl/', MyModel.as_view()),
]
  1. That's it. Now you will have common GET/POST/PUT/DELETE methods on your model. Also you can attach query_params only for id in your url. For example:
http://localhost:8000/myurl/?id=1
  1. You can also override get, post, put and delete method according to your need. For example:
from django.db import models
from easy_api.models import EasyAPI

class MyModel(EasyAPI):
	# Your Requried field here.
	
	def get(self, request):
		#Your logic

About

django-model-api is a python library which can be used in your project for creating automatic api by just creating the models. For for info read README.me.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages