Skip to main content

Do not quit using Django just because of Django Rest Framework, Django is JSOMe

Project description

Djapy - Django Framework is enough

Djapy is a simple Django library that provides complete control to the developers to instantly create restful APIs with minimal code. It is a simple library that provides a set of classes and decorators that can be used to create restful APIs.

Installation

pip install djapy

Usage

from django.views.decorators.csrf import csrf_exempt

from djapy import djapy_view, model_to_json_node, node_to_json_response
from moko.models import Todo


def moko_post(request):
    todo = Todo.objects.first()
    todo.title = request.POST.get('title')
    todo.save()
    return todo


@djapy_view(['id', 'title', 'completed'], False)
def moko(request):
    return {
        'post': moko_post,
        'get': Todo.objects.all
    }


@csrf_exempt
@node_to_json_response
@model_to_json_node(['id', 'username'])
def moko_user(request):
    return request.user

Create RESTful APIs with Django Framework, without writing serializers, views, urls, etc. Or without bu11shi**s.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djapy-0.1.0.tar.gz (14.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page