All Projects → eadwinCode → django-ninja-extra

eadwinCode / django-ninja-extra

Licence: MIT license
Django Ninja Extra - Class-Based Utility and more for Django Ninja(Fast Django REST framework)

Programming Languages

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

Projects that are alternatives of or similar to django-ninja-extra

django-rest-framework-recaptcha
reCAPTCHA field for Django REST framework serializers
Stars: ✭ 24 (-54.72%)
Mutual labels:  django-rest-framework, drf
django-rest-framework-datatables-editor
Seamless integration between Django REST framework, Datatables and Datatables Editor.
Stars: ✭ 25 (-52.83%)
Mutual labels:  django-rest-framework, drf
drf-angular-docker-tutorial
Dockerized Django Back-end API using DRF with Angular Front-end Tutorial
Stars: ✭ 53 (+0%)
Mutual labels:  django-rest-framework, drf
django-rest-multitokenauth
An extension to Django-Rest-Frameworks Token Authentication, enabling a user to have multiple authorization tokens
Stars: ✭ 13 (-75.47%)
Mutual labels:  django-rest-framework, drf
drf-registration
Simple user registration package based on Django Rest Framework. DRF Registration - The easy way to generate registration RESTful APIs
Stars: ✭ 32 (-39.62%)
Mutual labels:  django-rest-framework, drf
django-rest-framework-example
REST framework example for Django < 1.9 // New version ->
Stars: ✭ 29 (-45.28%)
Mutual labels:  django-rest-framework
rest-framework-latex
A LaTeX renderer for Django REST Framework
Stars: ✭ 30 (-43.4%)
Mutual labels:  django-rest-framework
python-web-dev-21-2
Material for "Web Development in Python with Django" using Django 2.1, published as a Pearson LiveLesson on Safari Books Online
Stars: ✭ 38 (-28.3%)
Mutual labels:  django-rest-framework
ai web RISKOUT BTS
국방 리스크 관리 플랫폼 (🏅 국방부장관상/Minister of National Defense Award)
Stars: ✭ 18 (-66.04%)
Mutual labels:  django-rest-framework
Shappar
気軽に投票を【取れる】【見れる】【できる】アプリです。
Stars: ✭ 22 (-58.49%)
Mutual labels:  django-rest-framework
tscharts
Django REST framework-based Digital Patient Registration and EMR backend
Stars: ✭ 14 (-73.58%)
Mutual labels:  django-rest-framework
django-firebase-auth
Django DRF authentication provider for Google's Firebase Authentication Service
Stars: ✭ 50 (-5.66%)
Mutual labels:  django-rest-framework
repanier
Django extension : web tool for short circuit food supply
Stars: ✭ 18 (-66.04%)
Mutual labels:  django-rest-framework
DjangoStarter
基于Django定制的快速Web开发模板,功能包括:Docker-Compose部署,缓存,业务代码生成器,接口限流,DjangoAdmin验证码,登录次数尝试,屏蔽了RestFramework默认的API主页等
Stars: ✭ 28 (-47.17%)
Mutual labels:  drf
school-navigator
Navigate the Durham, NC public school system
Stars: ✭ 25 (-52.83%)
Mutual labels:  django-rest-framework
agent
Job tracker & performance platform
Stars: ✭ 26 (-50.94%)
Mutual labels:  django-rest-framework
open
The most boring open source you've ever seen ....
Stars: ✭ 109 (+105.66%)
Mutual labels:  django-rest-framework
oms cms
A Django content management system focused on flexibility and user experience
Stars: ✭ 18 (-66.04%)
Mutual labels:  django-rest-framework
drf-turbo
An alternative serializer implementation for REST framework written in cython built for speed.
Stars: ✭ 73 (+37.74%)
Mutual labels:  django-rest-framework
dr scaffold
scaffold django rest apis like a champion 🚀
Stars: ✭ 116 (+118.87%)
Mutual labels:  django-rest-framework

Test PyPI version PyPI version PyPI version PyPI version Codecov Downloads

Django Ninja Extra

Django Ninja Extra is a complete class-based fashion of building and setting up APIs at incredible speed with incredible performance. It utilizes Django Ninja core features without compromising speed.

Key features:

All Django-Ninja features :

  • Easy: Designed to be easy to use and intuitive.
  • FAST execution: Very high performance thanks to Pydantic and async support.
  • Fast to code: Type hints and automatic docs lets you focus only on business logic.
  • Standards-based: Based on the open standards for APIs: OpenAPI (previously known as Swagger) and JSON Schema.
  • Django friendly: (obviously) has good integration with the Django core and ORM.

Plus Extra:

  • Class Based: Design your APIs in a class based fashion.
  • Permissions: Protect endpoint(s) at ease with defined permissions and authorizations at route level or controller level.
  • Dependency Injection: Controller classes supports dependency injection with python Injector or django_injector. Giving you the ability to inject API dependable services to APIController class and utilizing them where needed

Requirements

  • Python >= 3.6
  • django >= 2.1
  • pydantic >= 1.6
  • Django-Ninja >= 0.16.1

Django-Ninja Benchmark

Django-Ninja-Extra uses Django-Ninja under the hood, it can be assumed that Django-Ninja-Extra has the same benchmark with Django-Ninja Django Ninja REST Framework

Full documentation, visit.

Example

Checkout this sample project: https://github.com/eadwinCode/bookstoreapi

Installation

pip install django-ninja-extra

After installation, add ninja_extra to your INSTALLED_APPS

INSTALLED_APPS = [
    ...,
    'ninja_extra',
]

Usage

In your django project next to urls.py create new api.py file:

from ninja_extra import NinjaExtraAPI, api_controller, http_get

api = NinjaExtraAPI()

# function based definition
@api.get("/add", tags=['Math'])
def add(request, a: int, b: int):
    return {"result": a + b}

#class based definition
@api_controller
class MathAPI:

    @http_get('/subtract',)
    def subtract(self, a: int, b: int):
        """Subtracts a from b"""
        return {"result": a - b}

    @http_get('/divide',)
    def divide(self, a: int, b: int):
        """Divides a by b"""
        return {"result": a / b}
    
    @http_get('/multiple',)
    def multiple(self, a: int, b: int):
        """Multiples a with b"""
        return {"result": a * b}
    
api.register_controllers(
    MathAPI
)

Now go to urls.py and add the following:

...
from django.urls import path
from .api import api

urlpatterns = [
    path("admin/", admin.site.urls),
    path("api/", api.urls),  # <---------- !
]

Interactive API docs

Now go to http://127.0.0.1:8000/api/docs

You will see the automatic interactive API documentation (provided by Swagger UI):

Swagger UI

What next?

  • To support this project, please give star it on Github
  • API Throttling
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].