# Published django-block-fragments

**URL:** <https://forum.djangoproject.com/t/published-django-block-fragments/39500>\
**Category:** Show & Tell\
**Created:** [March 12, 2025, 10:57am UTC](https://forum.djangoproject.com/t/published-django-block-fragments/39500 "2025-03-12T10:57:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![medihack](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/medihack/32/10640_2.png) [@medihack](https://forum.djangoproject.com/u/medihack)\
**Post date:** [March 12, 2025, 10:57am UTC](https://forum.djangoproject.com/t/published-django-block-fragments/39500/1 "2025-03-12T10:57:18Z")

</div>

Hello everyone! Yesterday I published the first release of [django-block-fragments](https://github.com/medihack/django-block-fragments) on PyPI. It is an alternative to the wonderful [django-template-partials](https://github.com/carltongibson/django-template-partials) by Carlton Gibson and [django-render-block](https://github.com/clokep/django-render-block) by Patrick Cloke (and also uses many code fragments of both projects).

The idea is to render only the content of a specific `block` of a Django template. This is especially useful when using Django with libraries like HTMX, see [Template Fragments](https://htmx.org/essays/template-fragments/).

You may wonder what distinguishes django-block-fragments from django-template-partials or django-render-block. In contrast to the more powerful django-template-partials it reuses the already existing `block` template tag (in contrast to some custom `partialdef` and `partial` template tag). You also don’t have to specify the `block` as `inline` as it always is. And in comparison to django-render-block it uses the convenience of template loaders. So you can render a “content” block for example by calling `render(request, "template.html#content", {})` or using `{% include "template.html#content" %}` inside a template.

It’s still an early release, and I am happy to receive feedback, comments, or reported issues. I hope this library proves helpful to others.

---

<div class="post-metadata">

**Author:** ![csabhijeet](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/csabhijeet/32/27154_2.png) [@csabhijeet](https://forum.djangoproject.com/u/csabhijeet)\
**Post date:** [March 18, 2025, 8:46am UTC](https://forum.djangoproject.com/t/published-django-block-fragments/39500/2 "2025-03-18T08:46:39Z")

</div>

This looks really useful, especially for HTMX users! Being able to render specific template blocks so easily is a great feature. I’ll definitely check it out.

Thanks for sharing, and congrats on the first release!
