{"id":28460287,"url":"https://github.com/mounirmesselmeni/htmxango","last_synced_at":"2026-05-03T21:34:51.673Z","repository":{"id":221245390,"uuid":"753840836","full_name":"mounirmesselmeni/htmxango","owner":"mounirmesselmeni","description":"Django with HTMX","archived":false,"fork":false,"pushed_at":"2024-11-20T19:55:43.000Z","size":67,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-13T20:04:51.860Z","etag":null,"topics":["cbv","django","htmx"],"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/mounirmesselmeni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-06T22:15:37.000Z","updated_at":"2024-11-20T19:55:44.000Z","dependencies_parsed_at":"2024-02-06T23:30:13.086Z","dependency_job_id":null,"html_url":"https://github.com/mounirmesselmeni/htmxango","commit_stats":null,"previous_names":["mounirmesselmeni/htmxango"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mounirmesselmeni/htmxango","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mounirmesselmeni%2Fhtmxango","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mounirmesselmeni%2Fhtmxango/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mounirmesselmeni%2Fhtmxango/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mounirmesselmeni%2Fhtmxango/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mounirmesselmeni","download_url":"https://codeload.github.com/mounirmesselmeni/htmxango/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mounirmesselmeni%2Fhtmxango/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32586187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cbv","django","htmx"],"created_at":"2025-06-07T02:09:06.971Z","updated_at":"2026-05-03T21:34:51.655Z","avatar_url":"https://github.com/mounirmesselmeni.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTMXango\n\nThis is a demonstration of how to use htmx with Django to create a modern web application with minimal javascript.\nThe challenge here is to use CBVs and satisfy the need of htmx partial html rendering.\n\n## How to run\n\n1. Clone the repository\n2. Install [uv](https://docs.astral.sh/uv/)\n3. Run `uv python install`\n4. Run `uv sync`\n5. Run `uv run python manage.py migrate`\n6. Run `uv run python manage.py runserver`\n\n## How to use\n\n1. Go to `http://localhost:8000/todos/`\n2. Click on the buttons to see the magic happening\n3. Add a new todo\n4. ...\n\n## How it works\n\nCheck the `todos/views.py` where the logic is implemented on how to respond with full or partial HTML if the request is coming from an htmx or normal request.\n\nWe rely on three major projects here:\n\n- [htmx](https://htmx.org/) HTMX is a javascript library that allows you to access AJAX, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypertext.\n- [django-htmx](https://github.com/adamchainz/django-htmx) A Django app to make using htmx easier.\n- [django-render-block](https://github.com/clokep/django-render-block) A Django app to allow rendering of individual blocks from a template and avoid splitting templates into partials and overuse include tags. Keep in mind that include come with a cost of performance specially if you have a lot of them e.g in a loop.\n\nOther tools like Boostrap5 and crispy-forms are used to make the example more complete.\n\n## Using CBVs\n\nI'm not a big fan of function based views, so I've used class based views with small adjustments to make it work with htmx.\n\nThe CBVs can have with the help of the `HtmxTemplateResponseMixin` a `htmx_template_block` attribute that will be used to render the block of the template that will be sent back to the client if the request is originated from htmx.\n\nThe actual work of that is done in the `HtmxResponseClass` which make use of django-render-block to render the block and send it back to the client.\n\nCheck the `todos/views.py` for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmounirmesselmeni%2Fhtmxango","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmounirmesselmeni%2Fhtmxango","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmounirmesselmeni%2Fhtmxango/lists"}