Skip to main content

A set of django tools to help you create JSON service..

Project description


A set of django tools to help you create JSON service.


pip install django-apiview

Installed Decorators

  • @apiview
  • @requires(*parameter_names)
  • @choices(field, choices, allow_none=False)
  • @between(field, min, max, include_min=True, include_max=True, annotation=Number, allow_none=False)
  • @rsa_decrypt(field, private_key_instance)


  • apiview = Apiview(SimpleJsonPacker())



  • You DON'T need to put django_apiview into INSTALLED_APPS.
  • Apiview always set csrf_exempt=True.
  • @apiview decorator must be the first decorator.
  • Return raw data without serialized.


import time
from django_apiview.views import apiview
from django_apiview.views import requires
from django_apiview.views import choices
from django_apiview.views import between

def ping():
    return "pong"

def timestamp():
    return int(time.time())

def echo(msg: str):
    return msg

def getBooleanResult(value : bool):
    return value

def getIntegerResult(value: int):
    return value

def getBytesResult(value: bytes):
    return value

@choices("op", ["+", "-", "*", "/"])
@between("a", 2, 10, include_min=False)
@between("b", 2, 10, include_max=False)
def calc(a: int, op: str, b: int):
    if op == "+":
        return a + b
    if op == "-":
        return a - b
    if op == "*":
        return a * b
    if op == "/":
        return a / b

Bug report

Please report any issues at


v0.3.4 2020/07/26

  • Fix BizError class check problem.

v0.3.3 2020/07/24

  • Add rsa_decrypt decorator.

v0.3.2 2020/07/18

  • Add Apiview class based implementation.
  • Add setup_result_packer api.
  • Rename simple_json_result_packer to simple_result_packer.

v0.3.1 2020/07/01

  • Change app name from apiview to django_apiview.
  • Add parameter validators.
  • WARN: NOT backward compatible.


  • Using fastutils.typingutils for annotation cast.
  • Add result pack mechanism.
  • Move example views from the main app to example app and the example app is not include in published package.


  • Add logging while getting result failed in @apiview.
  • Add Map, List annotations.


  • Fix form process problem.


  • Add PAYLOAD injection, PAYLOAD field has low priority.


  • First release,

Project details

Download files

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

Files for django-apiview, version 0.3.4
Filename, size File type Python version Upload date Hashes
Filename, size django-apiview-0.3.4.tar.gz (5.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page