{"id":17909073,"url":"https://github.com/mback2k/swampdragon-live","last_synced_at":"2025-04-03T08:34:47.257Z","repository":{"id":57472619,"uuid":"54801273","full_name":"mback2k/swampdragon-live","owner":"mback2k","description":"Proof of Concept / Prototype: Live updating Django templates using SwampDragon and SwampDragon-auth","archived":false,"fork":false,"pushed_at":"2016-12-27T16:11:58.000Z","size":31,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-08T22:13:12.218Z","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":"2016-03-26T21:53:07.000Z","updated_at":"2019-10-26T21:46:57.000Z","dependencies_parsed_at":"2022-09-10T04:13:10.981Z","dependency_job_id":null,"html_url":"https://github.com/mback2k/swampdragon-live","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mback2k%2Fswampdragon-live","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mback2k%2Fswampdragon-live/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mback2k%2Fswampdragon-live/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mback2k%2Fswampdragon-live/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mback2k","download_url":"https://codeload.github.com/mback2k/swampdragon-live/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246967724,"owners_count":20862300,"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.159Z","updated_at":"2025-04-03T08:34:47.219Z","avatar_url":"https://github.com/mback2k.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[SwampDragon-live](https://github.com/mback2k/swampdragon-live) is an\nextension to [Django](https://www.djangoproject.com/) and\n[SwampDragon](http://swampdragon.net/) with SwampDragon-auth and django-redis\nwhich adds support for live updating Django template snippets on model changes.\n\nInstallation\n------------\nInstall the latest version from pypi.python.org:\n\n    pip install SwampDragon-live\n\nInstall the development version by cloning the source from github.com:\n\n    pip install git+https://github.com/mback2k/swampdragon-live.git\n\nConfiguration\n-------------\nAdd the package to your `INSTALLED_APPS`:\n\n    INSTALLED_APPS += (\n        'swampdragon',\n        'swampdragon_live',\n    )\n\nExample\n-------\nMake sure to use django-redis as a Cache backend named 'swampdragon-live' or 'default':\n\n    CACHES = {\n        'swampdragon-live': {\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\nMake sure to add the following line to your Django settings file:\n\n    SWAMP_DRAGON_CONNECTION = ('swampdragon_auth.socketconnection.HttpDataConnection', '/data')\n\nLoad the required JavaScript template-tags within your Django template:\n\n    {% load swampdragon_tags %}\n    {% load swampdragon_live %}\n\nAdd the required JavaScript to your Django template:\n\n    {% swampdragon_settings %}\n    \u003cscript type=\"text/javascript\" src=\"{{ STATIC_URL }}swampdragon/js/dist/swampdragon.min.js\"\u003e\u003c/script\u003e\n    \u003cscript type=\"text/javascript\" src=\"{{ STATIC_URL }}swampdragon/js/live/swampdragon.live.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 'table' '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 'table-row' 'includes/row_cols.html' row=row perms=perms %}\n\nUse the swampdragon_live 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=\"{{ swampdragon_live }}\"\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_swampdragon_live` like this:\n\n    {% if is_swampdragon_live %}\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-2016 Marc Hoersken \u003cinfo@marc-hoersken.de\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmback2k%2Fswampdragon-live","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmback2k%2Fswampdragon-live","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmback2k%2Fswampdragon-live/lists"}