Skip to main content

No project description provided

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

Uploaded Source

Built Distribution

django_includes-1.0.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_includes-1.0.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.1 Darwin/21.6.0

File hashes

Hashes for django_includes-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1646991c8998a8f6a4c0f7cd8132ba41d2610f797e360eaf4f889a1a6de14dae
MD5 a1a5d84f05fcc5f1bd93a8009fcbb421
BLAKE2b-256 caf01e41dce9f73daa6841f63fb16251b315c8490ce1d7d20fcbd6b9c9214321

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_includes-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.1 Darwin/21.6.0

File hashes

Hashes for django_includes-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e15227e33cfce7be7f5c294ddce722d57a7a9a48b12db1aaf995735bc7c9c0d
MD5 ebf514d0738f976d80ebdb8a38956c93
BLAKE2b-256 1161b650c74addf9d00bf765e98b38098cced2eabaa42e9aa9095c8c9d2fb7bd

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