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.2.3.tar.gz (5.8 kB view details)

Uploaded Source

Built Distributions

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

Uploaded Source

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

Uploaded Source

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

Uploaded Source

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_includes-0.2.3.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for django_includes-0.2.3.tar.gz
Algorithm Hash digest
SHA256 f5b100bb234a217b2caa4cc5cad3dc4ae4aabca0b5b78d7fdc0d5904dab6e5f4
MD5 d4a6418dfc41c1dc0423b2f0ca73a453
BLAKE2b-256 445d974f5381c8a69f8c68e65f7779f80bd5ac3750fcb7df63cd94ad54a81283

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_includes-0.2.3-py3.7.egg
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for django_includes-0.2.3-py3.7.egg
Algorithm Hash digest
SHA256 6f0a966532fd5cbf913e49eeed59bc9e703a29b036d67764f8d5ab3033830630
MD5 16715992886cbe1ceece0ecaeb6f5eac
BLAKE2b-256 02f75f94f9eb622c306d9dd37ada62bb6f2b7ee757d749cbde92b16dfc536693

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_includes-0.2.3-py3.6.egg
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for django_includes-0.2.3-py3.6.egg
Algorithm Hash digest
SHA256 57b165b02a2bc839304825519243a1ec8dddeeaec3da63260ca4e379ba566326
MD5 7a5dd30a9d8216fef07d46b52f9f2583
BLAKE2b-256 4011b36f0a4c3b71ba550dc0173c07cb55e82bfbe9531cba3fbbbf42200710cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_includes-0.2.3-py3.5.egg
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for django_includes-0.2.3-py3.5.egg
Algorithm Hash digest
SHA256 c6236e30852c6a73feb04063fced6026a2aac2024e6ce96342532e1672ebf3ad
MD5 a392fd8461206dd3f2d607c910ec04c8
BLAKE2b-256 59399b4c7851c434cb19883ccdbca65738b1e550b36f11e9bc770d3dcd2590e2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_includes-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for django_includes-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bdc443fb1a007df4ffe3437e77cd9eb74861197a9540c938a8c2217349d447e2
MD5 977df4b50dbc866af316999ea480fe68
BLAKE2b-256 0ac1ac2a3549794d892dfe23d18b378ca7addbb4141f094826915a7c7fdf33ce

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