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

Uploaded Source

Built Distributions

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

Uploaded Source

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

Uploaded Source

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

Uploaded Source

django_includes-0.2.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for django_includes-0.2.1.tar.gz
Algorithm Hash digest
SHA256 221bb520c78519d890063aa30e90bd373882565616392d747141a9b97baee63f
MD5 8c2a7d59b39d3b984029ff81e37ae455
BLAKE2b-256 7fad1a57fead4407c21ef1e3a35f30b951cd77f38fd587ec8e00c0fdc9f62d66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_includes-0.2.1-py3.7.egg
Algorithm Hash digest
SHA256 c837ffce674253acd7657287c4be7a567832d6a7eb95f6aab5f1570cbf083b0d
MD5 2cdb0d854e84180f031e4c87302a3549
BLAKE2b-256 cf57b464427b169c0c423c921231aabb452383215fdbb97a48973f25716fefd5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_includes-0.2.1-py3.6.egg
Algorithm Hash digest
SHA256 b1a3b04d46afc6621f74dceb63abfd8c7521cdd60b76c47fb79c22a1a9ee4ba1
MD5 8d03ab2cd8a8fd827f1663365bb5ca76
BLAKE2b-256 0f4d97694044f40437c64a57971d607899b7b667c09a2635b08f8dc0e7feef29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_includes-0.2.1-py3.5.egg
Algorithm Hash digest
SHA256 5ebef76f6724332c4ce1eb02c1ac8494e4b09b495968a86f450547a823c892d5
MD5 f0add2557a1cc16388d5fbe125ea5e49
BLAKE2b-256 f0115271c3057264bec38b794662b6d6fc37a2a9962cb50c6df206e310dde07c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_includes-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5fb717ff636441b71b181a69598d5a3a1d74677bc0c75ed7b57aecfd4ccc191a
MD5 ea0571909add01cbb99f35cab975c080
BLAKE2b-256 8b656cc92b12a0529e7b7f72977ba521fe66daa66d641c7fc0ef287cef149de6

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