{"id":17909075,"url":"https://github.com/mback2k/django-live-templates","last_synced_at":"2025-03-23T20:31:23.977Z","repository":{"id":34008323,"uuid":"165717985","full_name":"mback2k/django-live-templates","owner":"mback2k","description":"Proof of Concept / Prototype: Live updating Django templates using Channels and Redis","archived":false,"fork":false,"pushed_at":"2022-12-26T21:31:27.000Z","size":153,"stargazers_count":3,"open_issues_count":9,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-02T04:51:19.169Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mback2k.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-14T19:04:07.000Z","updated_at":"2021-11-09T09:39:05.000Z","dependencies_parsed_at":"2023-01-15T03:55:49.613Z","dependency_job_id":null,"html_url":"https://github.com/mback2k/django-live-templates","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mback2k%2Fdjango-live-templates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mback2k%2Fdjango-live-templates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mback2k%2Fdjango-live-templates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mback2k%2Fdjango-live-templates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mback2k","download_url":"https://codeload.github.com/mback2k/django-live-templates/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245164964,"owners_count":20571217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-28T19:19:56.171Z","updated_at":"2025-03-23T20:31:23.632Z","avatar_url":"https://github.com/mback2k.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[Django-Live-Templates](https://github.com/mback2k/django-live-templates) is\nan extension to [Django](https://www.djangoproject.com/) and\n[Channels](https://channels.readthedocs.io/) which adds\nsupport for live updating Django template snippets on model changes.\n\nThis project is based upon and a partial reimplementation to Channels of\n[SwampDragon-live](https://github.com/mback2k/swampdragon-live) which was build\nusing [SwampDragon](https://github.com/hagsteel/swampdragon)\nwith SwampDragon-auth and django-redis.\n\nInstallation\n------------\nInstall the latest version from pypi.python.org:\n\n    pip install django-live-templates\n\nInstall the development version by cloning the source from github.com:\n\n    pip install git+https://github.com/mback2k/django-live-templates.git\n\nConfiguration\n-------------\nAdd the package to your `INSTALLED_APPS`:\n\n    INSTALLED_APPS += (\n        'channels',\n        'django_live_templates',\n    )\n\nExample\n-------\nMake sure to use django-redis as a Cache backend named 'django-live-templates' or 'default':\n\n    CACHES = {\n        'django-live-templates': {\n            'BACKEND': 'django_redis.cache.RedisCache',\n            'LOCATION': 'redis://localhost:6379/0',\n            'OPTIONS': {\n                'CLIENT_CLASS': 'django_redis.client.DefaultClient',\n            }\n        }\n    }\n\nLoad the required JavaScript template-tags within your Django template:\n\n    {% load django_live_template %}\n\nAdd the required JavaScript to your Django template:\n\n    \u003cscript type=\"text/javascript\" src=\"{{ STATIC_URL }}js/django_live_template.js\"\u003e\u003c/script\u003e\n\nUse the include_live template-tag instead of the default include template-tag,\nwith rows being a Django database QuerySet to listen for added, changed, deleted instances:\n\n    {% include_live 'includes/table_body.html' rows=rows perms=perms %}\n\nUse the include_live template-tag instead of the default include template-tag,\nwith row being a single Django database Model instance to listen for changes:\n\n    {% include_live 'includes/row_cols.html' row=row perms=perms %}\n\nUse the django_live_template variable within the included template to add the\nrequired classes to the root-tag of this template, e.g. the first tag-node:\n\n    \u003ctr class=\"{{ django_live_template }}\"\u003e...\u003c/tr\u003e\n\nYou can check if your template is being live rendered by a content pusher by\nusing the context variable `is_django_live_template` like this:\n\n    {% if is_django_live_template %}\n    \u003cstyle onload=\"alert('Hello World!');\"\u003e\u003c/style\u003e\n    {% endif %}\n\nA real-world example can be found in the Django project WebGCal:\n* https://github.com/mback2k/django-webgcal/blob/master/webgcal/apps/webgcal/templates/show_dashboard.html\n* https://github.com/mback2k/django-webgcal/tree/master/webgcal/apps/webgcal/templates/includes\n\nLicense\n-------\n* Released under MIT License\n* Copyright (c) 2015-2019 Marc Hoersken \u003cinfo@marc-hoersken.de\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmback2k%2Fdjango-live-templates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmback2k%2Fdjango-live-templates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmback2k%2Fdjango-live-templates/lists"}