django-planet

Blog: Matthias Kestenholz: Posts about Django

web https://406.ch/writing/category-django/
Author

Django admin tip: Adding links to related objects in change forms

Jan. 17, 2025 » Matthias Kestenholz: Posts about Django » [Archived Version]

Django admin tip: Adding links to related objects in change forms Any issue which came up on the Django Forum and Discord is how to add links to other objects to the Django administration interface. It’s something I’m doing often and I want to share the pattern I’m using. It’s definitely not rocket science and there are probably better ways to do it, but this one works well for me. Method 1: Override the change form template In one project users can be the editor of exac…

Read More

Weeknotes (2025 week 03)

Jan. 15, 2025 » Matthias Kestenholz: Posts about Django » [Archived Version]

Weeknotes (2025 week 03) Claude AI helped me for the first time django-imagefield prefers processing thumbnails, cropped images etc. directly when saving the model and not later on demand; it’s faster and also you’ll know it immediately when an image couldn’t be processed for some reason instead of only later when people actually try browsing your site. A consequence is that if you change formats you have to remember that you have to reprocess the images. The Django app comes …

Read More

Weeknotes (2024 week 51)

Dec. 20, 2024 » Matthias Kestenholz: Posts about Django » [Archived Version]

Weeknotes (2024 week 51) Building forms using Django I last wrote about this topic in April. It has resurfaced on Mastodon this week. I’m thinking about writing a feincms3-forms demo app, but I already have too much on my plate. I think composing a forms builder on top of django-content-editor is the way to go, instead of replacing the admin interface altogether – sure, you can always do that, but it’s so much less composable… Releases blacknoise 1.2: No real changes, …

Read More

Object-based assets for Django's forms.Media

Dec. 18, 2024 » Matthias Kestenholz: Posts about Django » [Archived Version]

Object-based assets for Django’s forms.Media The pull request for adding object-based script media assets into Django is in a good state and I hope it will be merged soon. I have been using object-based assets long before Django actually added support for them in 4.1 (since 2016, that’s before Django 1.10!) by using a gross hack. Luckily I have been able to clean up the code when Django 4.1 landed. I have been asking myself at times why I haven’t proposed the change to Django …

Read More

Weeknotes (2024 week 49)

Dec. 6, 2024 » Matthias Kestenholz: Posts about Django » [Archived Version]

Weeknotes (2024 week 49) Django Steering Council elections I have been thinking long and hard about running for the Django Steering Council. I think there are a few things I could contribute since I’ve been using Django for 16 or more years, and have been working on, maintaining and publishing third-party apps almost all this time. I have also contributed a few small features to Django core itself, and contributed my fair share of tests and bugfixes. The reason why I haven’t been mo…

Read More

Rebuilding django-prose-editor from the ground up

Dec. 4, 2024 » Matthias Kestenholz: Posts about Django » [Archived Version]

Rebuilding django-prose-editor from the ground up The django-prose-editor package provides a HTML editor based upon the ProseMirror toolkit for the Django administration interface and for the frontend. The package has been extracted from a customer project and open sourced so that it could be used in other projects as well. It followed a very restricted view of how rich text editors should work, which I have initially added to the FeinCMS repository when documenting the design decisions more th…

Read More

Weeknotes (2024 week 47)

Nov. 20, 2024 » Matthias Kestenholz: Posts about Django » [Archived Version]

Weeknotes (2024 week 47) I missed a single co-writing session and of course that lead to four weeks of no posts at all to the blog. Oh well. Debugging I want to share a few debugging stories from the last weeks. Pillow 11 and Django’s get_image_dimensions The goal of django-imagefield was to deeply verify that Django and Pillow are able to work with uploaded files; some files can be loaded, their dimensions can be inspected, but problems happen later when Pillow actually tries resizing or…

Read More

Weeknotes (2024 week 43)

Oct. 23, 2024 » Matthias Kestenholz: Posts about Django » [Archived Version]

Weeknotes (2024 week 43) I had some much needed time off, so this post isn’t that long even though four weeks have passed since the last entry. From webpack to rspack I’ve been really happy with rspack lately. Converting webpack projects to rspack is straightforward since it mostly supports the same configuration, but it’s much much faster since it’s written in Rust. Rewriting things in Rust is a recurring theme, but in this case it really helps a lot. Building the front…

Read More

Weeknotes (2024 week 39)

Sept. 25, 2024 » Matthias Kestenholz: Posts about Django » [Archived Version]

Weeknotes (2024 week 39) CSS for Django forms Not much going on in OSS land. I have been somewhat active in the official Django forum, discussing ways to add Python-level hooks to allow adding CSS classes around form fields and their labels. The discussion on the forum and on the pull request goes in the direction of allowing using custom BoundField classes per form or even per project (instead of only per field as is already possible today). This would allow overriding css_classes, e.g. to add…

Read More

django-content-editor now supports nested sections

Sept. 13, 2024 » Matthias Kestenholz: Posts about Django » [Archived Version]

django-content-editor now supports nested sections django-content-editor (and it’s ancestor FeinCMS) has been the Django admin extension for editing content consisting of reusable blocks since 2009. In the last years we have more and more often started automatically grouping related items, e.g. for rendering a sequence of images as a gallery. But, sometimes it’s nice to give editors more control. This has been possible by using blocks which open a subsection and blocks which close a…

Read More