A template tag for making simulated GET requests to Django application view functions. The HTTP response can be displayed in the given template.
Variations of usage of viewssi:
{% viewssi path.to.view %}
{% viewssi path.to.view arg,arg2,kwarg=val %}
{% viewssi path.to.view arg,arg2,kwarg=val as var %}
{% viewssi path.to.view arg,arg2,kwarg=val get p1=v1,p2=v2 as var %}
The first argument is the path to a view function to call. If the view requires args and/or kwargs, pass them as the second token in the tag. args and the values of kwargs are resolved to template variables unless they are quoted.
The view doesn’t have to be exposed in a URL configuration. Essentially any function can be called that accepts one argument (the request) and returns a django.http.HttpResponse object.
You can pass a GET query string by including a get token in the tag followed by key=value pairs. Parameter values are also resolved to template variables unless they are quoted.
If the as <template-variable-name token of the tag is provided, the view’s response is assigned to the given template variable. Otherwise, the response content is returned in place.
When the response is assigned to a template variable, the http response is represented as a HttpResponseProxy object which contains a template-useable interface for fetching the response code, headers, and content. Examples:
{% ifequal response.status_code "200" %}
{{ response }}
{% endifequal %}
HttpResponseProxy behaves is a dict-like object. The http response headers are set as the dict items and their names are transposed for use in templates, i.e. ‘Content-type’ becomes ‘content_type’. For example:
{% ifequal response.content_type "text/html" %}
{% endifequal %}
Metadata
Release files for django-viewssi 0.1.1
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 | Actions |
|---|---|---|---|---|
| django-viewssi-0.1.1.tar.gz | 4.9 kB | Without provenance | Details for django-viewssi-0.1.1.tar.gz |
Release files / django-viewssi-0.1.1.tar.gz
| Download URL | django-viewssi-0.1.1.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
919e5cdaffb58edb41245f8878f24967e3d2c50240f19abab33b81cf6c51aa8a
|
|
BLAKE2b-256 checksum How to use checksums |
816b64778d6ec3b2ca18d638d8ab6c419195d1f5bdee8bed3f5038acda6bd0b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-viewssi 0.1.1
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.