Skip to main content

Build Status PyPI Version Coverage Status Python 3.4+ Django 1.8, 1.10, 1.11, 2.0+ License MIT

django-http-method

Provide a workaround to use different method than GET or POST inside HTML forms in django templates. Works only with Class Based View.

Installation

From source code:

python setup.py install

From pip:

pip install django-http-method

Usage

Add django_http_method to your settings.INSTALLED_APPS
INSTALLED_APPS = (
    [...],
    django_http_method,
    [...],
)
Add the mixin to a CBV
from django.views.generic import View
from django_http_method import HttpMethodMixin

class TestView(HttpMethodMixin, View):
	pass
In your template, load http_method and use {% http_[method] %} in your forms:
{% load http_method %}

<form action="/" method="post">
    {% csrf_token %}
    {% http_put %}
    [...]
    <button type="submit">Send a PUT request</button>
</form>


<form action="/" method="post">
    {% csrf_token %}
    {% http_patch %}
    [...]
    <button type="submit">Send a PATCH request</button>
</form>

The corresponding method of your View will now be called. For instance, if {% http_put %} was used, then TestView.put() will be called and any request parameter will be in request.PUT.


Changelog

0.3.2

  • Added end slash '/' at the end of HTML input in templatetags

0.3.0

  • Removing '_method' from request parameters

Metadata

Release files for django-http-method 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-http-method 0.3.2
File Size Uploaded
django-http-method-0.3.2.tar.gz 4.5 kB Details

Release files / django-http-method-0.3.2.tar.gz

Download URL django-http-method-0.3.2.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
04a06446cb06649fde899ab5357919ec14a0924a640ea7e8f11abc16fbb8d597
BLAKE2b-256 checksum
How to use checksums
c02574aecc88f1cfffe867f84c46536c7495f2f71fbb50bc79b796bb0d603420
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

Release history Release notifications | RSS feed

1.2.1

1 release file

1.2.0

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.4.1

1 release file

0.4.0

1 release file

This release

0.3.2 This release

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page