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.4.0
- Will now search for parameters in body for methods PUT and PATCH
- Method will default to request.method if '_method' parameter was not found
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.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-http-method-0.4.0.tar.gz | 4.9 kB | Without provenance | Details |
Release files / django-http-method-0.4.0.tar.gz
| Download URL | django-http-method-0.4.0.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90954e7158ddc5065f1eb970709c2fa441262fd3274d2ca2fa194918c59bd4cb
|
|
BLAKE2b-256 checksum How to use checksums |
6e7c8c54272156dd96e179414913dd06f8c027298ffe8ca06edc986079b3f5b3
|
| 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.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3
|
Security for django-http-method 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.