I frequently consult the docs of Django's set of default template tags and filters and there's one part I often forget about, because it's not enabled by default: django.contrib.humanize. Here's a reminder.
Archive: #django
2025-12-08
▩︎ Django spotlight: humanize template filters
2025-12-04
⚡︎ Rootcause v1 released
Version 1.0 of Rootcause is now available.
The only changes are the removal of Django 5.1 from the test matrix and the addition of a changelog.
2025-12-02
▩︎ Customizing the HTML name of a Django form field
Django uses the name of the form field as the name attribute of the corresponding form element in HTML. If you ever need to change it, here's how (Django 5.2+).
2025-11-28
▩︎ A first look at Django's new background tasks
Django 6.0 introduces a built-in background tasks framework in django.tasks. But don't expect to phase out Celery, Huey or other preferred solutions just yet.
2025-11-24
▩︎ Django spotlight: SimpleLazyObject & Co.
We probably all know the ins and outs of Django models, and the settings we need to tweak before heading to production. But Django's packed with tiny bits of useful, lesser known constructs and functionality you can safely reuse. Like SimpleLazyObject.
2025-11-03
▩︎ Introducing Rootcause
Something that always made me wonder: why doesn't the IntegrityError raised by a database (driver) include some actual actionable data?
I don't know. I do know that it doesn't have to stay that way! With Rootcause you'll be able to gather all necessary information when you violate the most common types of constraints in Django.
import rootcause
try:
... # something violates a constraint
except IntegrityError as e:
cause = rootcause.resolve(e, model=MyModel)
if cause.is_check(name="max_amount"):
raise MaxAmountExceeded()
if cause.is_unique(name="payment_reference"):
raise AlreadyPaid()
The goal of Rootcause is twofold: provide more information and eliminate differences between databases.
Rootcause has been tested with recent versions of SQLite, PostgreSQL and MySQL, and requires Django 5.1 or better.