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

Uploaded Source

Built Distributions

django_includes-0.3.1-py3.8.egg (12.7 kB view details)

Uploaded Source

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

Uploaded Source

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

Uploaded Source

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

Uploaded Source

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_includes-0.3.1.tar.gz
  • Upload date:
  • Size: 6.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.1.tar.gz
Algorithm Hash digest
SHA256 11c2c4c5820a4a612752a89522b683bf4a278e057aecd1e9d3dd88f6e432c0c8
MD5 68f287259407eec92b228396b1ca4a7f
BLAKE2b-256 a320c96bdcfc00832e6e2a2faf7bba70ab8d2b39f2c3f427bc974fa346fcfb14

See more details on using hashes here.

File details

Details for the file django_includes-0.3.1-py3.8.egg.

File metadata

  • Download URL: django_includes-0.3.1-py3.8.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.1-py3.8.egg
Algorithm Hash digest
SHA256 d0f7858d9fe9ff937513a6feecb1fddbe10b40f5ed42fe9063bbc30a34b78860
MD5 c4265892629ee1ba6aac5b4aeac1fada
BLAKE2b-256 9cbb8b4561f968df211a82b19b7fcf799ee08e9e2ec0a283d46e706602635e84

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_includes-0.3.1-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.1-py3.7.egg
Algorithm Hash digest
SHA256 e65a4ea72d09019543c18ead5a9775fa4affe95dac3fec878ce0d9658249d425
MD5 85cf73934490506d968223e6a32bb80c
BLAKE2b-256 e2e676b76bd4b8cfa7d9ae91df376e272664c1ba74c389c0030b8558920da085

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_includes-0.3.1-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.1-py3.6.egg
Algorithm Hash digest
SHA256 240fa2fb9eba53bd09a5932f94b50ccc60c8f010eba15b82fce251ff7af13f27
MD5 8dbac9eaa27688f72823a617dd5e8c9e
BLAKE2b-256 e0f86532bd1e5c0389742669d992a92dcb6b88f6f3f7f1120e42f18986e4a2ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_includes-0.3.1-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.1-py3.5.egg
Algorithm Hash digest
SHA256 7f54ef17d3124b3ec239298daae38eb97cb55fa24a5071ec42fe23ded09ff153
MD5 85c3188f74f6f06df44fd8a51b8ac81b
BLAKE2b-256 a66e90766162a3c887c05e478d4c47bcbe683f36d0c330aa0cb67b728bc4d8b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_includes-0.3.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7dc28039d87898233ed620a0a798c8219241d5d96c9bab3a35276ddab623fb64
MD5 53a7752bd3c26f3814ed42304f768c41
BLAKE2b-256 b38639e9688ea56b28c8286dc46d959ae0c952205205b93ab030a35a9e77bd05

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