Skip to main content

ssi-views

A simple Django application to process SSI includes.

PyPI Build Status Software license

Compatibility

  • python >= 3.9
  • django >= 3.2

Features

  • Supported Function-Based and Class-Based Views
  • One URL pattern to rule them all for all SSI views
  • Jinja2 support

Installation

Install the latest release with pip:

pip install ssi-views

Add ssi_views to your INSTALLED_APPS in django's settings.py:

INSTALLED_APPS = [
    "ssi_views",
]

Add ssi_views.urls to your URLconf:

from django.urls import include, path

urlpatterns = [
    path("ssi/", include("ssi_views.urls")),
]

Usage

@ssi_view("name")

Use this decorator to register your views (Function-Based or Class-Based).

from ssi_views.decorators import ssi_view

@ssi_view("myapp.form")
def form_view(request):
    ...

@ssi_view("myapp.form_cbv")
class SSIFormView(FormView):
    ...

NOTE: The specified name has to be unique.

You can combine ssi_view with other decorators:

@csrf_exempt
@require_POST
@ssi_view("myapp.contact_form")
def csrf_exempt_view(request):
    # ...

{% ssi_include %}

Template tag to render <!--# include virtual="..." --> directive.

{% load ssi_views %}

{% ssi_include "myapp.form" %}

Output:

<!--# include virtual="/ssi/myapp.form/" -->

{% ssi_url %}

This tag is used to add SSI URLs in the template files:

{% load ssi_views %}

<!--# include virtual="{% ssi_url 'myapp.form' %}" -->

Multiple names

You can have multiple names for the same view:

from ssi_views.decorators import ssi_view

@ssi_view(["myapp.form", "myapp.fallback"])
def example_view(request):
    ...

Jinja2 support

Enable Jinja2 extension

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.jinja2.Jinja2",
        "OPTIONS": {
            "extensions": [
                ...
                "ssi_views.templatetags.ssi_views.SSIIncludeExtension",
            ]
        }
    }
]

NOTE: If you are using django-jinja, you don't need to do this.

The usage is similar to Django, except that ssi_url is a global function:

<!--# include virtual="{{ ssi_url('myapp.form') }}" -->

Metadata

Release files for ssi-views 0.6.0

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

Source distribution (sdist)

Source distribution for ssi-views 0.6.0
File Size Uploaded
ssi_views-0.6.0.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ssi-views 0.6.0
File Interpreter ABI Platform
ssi_views-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / ssi_views-0.6.0.tar.gz

Download URL ssi_views-0.6.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a26a908df8582323241fa57840abfbb329035d77166163b23862332aeba792dd
BLAKE2b-256 checksum
How to use checksums
44f65d589f6972e770d22532c21b8999a196487141d10154611e4728201b6d6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.12.8 Linux/6.5.0-1025-azure

Release files / ssi_views-0.6.0-py3-none-any.whl

Download URL ssi_views-0.6.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c15babfc999bd69b9fa2a36c72a4eac9f75da8e1adccbc1efe599cc478e4e65
BLAKE2b-256 checksum
How to use checksums
5cf508f59a41e8c9e34a2e04ff7b7a0e6fbfc1009d2d4c0a4662cb26a51d2808
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.12.8 Linux/6.5.0-1025-azure

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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