Skip to main content

Extra decorators for your Django project.

Project description

Package Documentation

Description

This package provides decorators to make building websites in Django even easier.

Installation

$ pip install django-decorator-plus

Basic Usage

The package currently supplies decorators to improve your views.

The require_http_methods() decorator is an enhanced version of the decorator supplied by Django.

@require_http_methods(["GET", "POST"])
def function_view(request):
    # HTTP methods != GET or POST results in 405 error code response

The require_http_methods() automatically supplies the OPTIONS HTTP method, and will automatically add the HEAD HTTP method if the GET method is allowed.

The package also supplies two shortcut decorators for your most common tasks:

  • require_safe_methods limits views to GET and HEAD.

  • require_form_methods limites views to GET, HEAD, and POST.

Project details


Download files

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

Source Distributions

django-decorator-plus-0.0.1a1.zip (9.1 kB view hashes)

Uploaded Source

django-decorator-plus-0.0.1a1.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

django_decorator_plus-0.0.1a1-py2.py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 2 Python 3

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