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

Uploaded Source

Built Distributions

django_includes-0.2.2-py3.7.egg (12.5 kB view details)

Uploaded Source

django_includes-0.2.2-py3.6.egg (12.5 kB view details)

Uploaded Source

django_includes-0.2.2-py3.5.egg (12.6 kB view details)

Uploaded Source

django_includes-0.2.2-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_includes-0.2.2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

File hashes

Hashes for django_includes-0.2.2.tar.gz
Algorithm Hash digest
SHA256 d078bde116e14ecb6973be8b2bc8d2101af746bcc2057d2070da6082c936578d
MD5 f2412058f3a578fed7d83e6b4ffd5364
BLAKE2b-256 fb9d3fda44e183f8ee1fbb0fabbcd0006bde44a256f8dff8805e21cca44da490

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_includes-0.2.2-py3.7.egg
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

File hashes

Hashes for django_includes-0.2.2-py3.7.egg
Algorithm Hash digest
SHA256 c2adff82e4e95f5c39c9531ad1820e17e5626e067338a911b20ef2d9163c58ad
MD5 e579daddeb9787658444aaaa0f22f868
BLAKE2b-256 46eff97d171476d576c34232ea1418f73d025bf9cb13023d969ca2f5146b8c73

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_includes-0.2.2-py3.6.egg
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

File hashes

Hashes for django_includes-0.2.2-py3.6.egg
Algorithm Hash digest
SHA256 1202203b34c7ac3d31c225b725838d0740893cea68a131bf82c0fb26ea6bd917
MD5 5dcbed87b72aa9d225ac0d0f92d7a452
BLAKE2b-256 51e10152aeb59491ef34734978705ba068e85840405014cd37c6b2f6b7b80f9b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_includes-0.2.2-py3.5.egg
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

File hashes

Hashes for django_includes-0.2.2-py3.5.egg
Algorithm Hash digest
SHA256 6358ae72d813af07d1cc308cb6f273fe6464aa745626890717971525ffd3c2f1
MD5 77188fe68a1ee00c763fec25ddcfcb33
BLAKE2b-256 38cdac571bb1559ff0ca87780a32cc0bdc0740d17a5253f137b8469b7b869568

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_includes-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

File hashes

Hashes for django_includes-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9574093a5263a588e310f30a308ad89875b785ce1154b8af7a61e82b4c320d01
MD5 c4b450546ae29d20f5de219599b4d1cf
BLAKE2b-256 d0383ce9c2f288cb4cef1ac1e4c300ba0439a8d944cb2700614a5ec694a0cc18

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