Skip to main content

Include django views as a subparts of other django views, using either HTTP (with esi or hinclude) or direct render.

Project description

Experimental software. There is no tests, no documentation, use it are your own risks (or don’t).

Currently testing that with django 2 and python 3.5+ only, which will be the only supported target.

Install

  • Add ‘django_includes’ to INSTALLED_APPS.

  • Add DjangoIncludesExtension to Jinja2 environment.

from django_includes.jinja2 import DjangoIncludesExtension

def environment(**options):
    env = Environment(**options)

    # your logic here

    env.add_extension(DjangoIncludesExtension)

    return env
  • Use {{ render_sync(request, ‘mused.views.MusicGroupListView’, musicgenre=object) }} in templates.

Now, that’s only the “synchronous render”,

Install hinclude

If you wanna use hinclude (a simple javascript that loads asynchronously some part of your page):

Add hinclude url to your project:

from django_includes.views import include_view

urlpatterns += [
    path('hinclude/<token>', include_view, kwargs={'via': 'hinclude'}, name='hinclude')
]

Add hinclude to your layout

<html lang="en" xmlns:hx="http://purl.org/NET/hinclude">
<head>
    <script src="{{ static('hinclude.js') }}"></script>
  • Use {{ render_hinclude(request, ‘mused.views.MusicGroupListView’, musicgenre=object) }} in templates.

Note that this will use json web tokens to encode the parameters, using your django secret as a “seed” for encryption.

Project details


Download files

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

Source Distribution

django_includes-0.3.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distributions

django_includes-0.3.0-py3.7.egg (12.6 kB view details)

Uploaded Source

django_includes-0.3.0-py3.6.egg (12.6 kB view details)

Uploaded Source

django_includes-0.3.0-py3.5.egg (12.7 kB view details)

Uploaded Source

django_includes-0.3.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file django_includes-0.3.0.tar.gz.

File metadata

  • Download URL: django_includes-0.3.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for django_includes-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5377775ba5f22a74af8c4970931abfc2816961e9e6563c12683ccc067383bea0
MD5 f61a7b38527e734f4aa89f3e3d93458b
BLAKE2b-256 ff154ec360768637baf9d7a3facb216b657b3631e7db8d3e2762a3a01e4f0bbf

See more details on using hashes here.

File details

Details for the file django_includes-0.3.0-py3.7.egg.

File metadata

  • Download URL: django_includes-0.3.0-py3.7.egg
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for django_includes-0.3.0-py3.7.egg
Algorithm Hash digest
SHA256 6aeebc493d4ba20044648ab6ed5a56ce9fb9f715df1e13d015f1aac3abec0ef3
MD5 6755f59626eb363d0d2568baf25158e6
BLAKE2b-256 a590c1337f308a8ebf1e393b3788db346418f69e4b7cd744d3ea51cd8b51e524

See more details on using hashes here.

File details

Details for the file django_includes-0.3.0-py3.6.egg.

File metadata

  • Download URL: django_includes-0.3.0-py3.6.egg
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for django_includes-0.3.0-py3.6.egg
Algorithm Hash digest
SHA256 f84b4f53af9602a7c9601cf04e34555e2bb840708c7f13ff38e9ad219c3a44a0
MD5 2110627b3821221bde616e454b00fc8e
BLAKE2b-256 a37208232e54c615fa06d4b6e9df972e0372aa4dd019dcf3fa161843470a4218

See more details on using hashes here.

File details

Details for the file django_includes-0.3.0-py3.5.egg.

File metadata

  • Download URL: django_includes-0.3.0-py3.5.egg
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for django_includes-0.3.0-py3.5.egg
Algorithm Hash digest
SHA256 42d16c397bb9aff8eb2fd25e2b45a980af7303015072dd92726eee8c81995a91
MD5 b23c31519b8f749fc0eebbba7e198aef
BLAKE2b-256 9a54d8b7860f69de71bf156ffbc5801dbdd714609a5b00f7c876e51525002c24

See more details on using hashes here.

File details

Details for the file django_includes-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: django_includes-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for django_includes-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d78cea05f9a8a93b5384e21b3d6bb66e531720934d3cac190bf7d69d901a404e
MD5 b458dcf73266c36b1d1c9bfd1d2be487
BLAKE2b-256 da2e5b743c5ed8fb217995d9e62bcea2909c82f030455d001e7b83322da583b9

See more details on using hashes here.

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