Weeknotes 2022-11-14

, Jochen

Lots of stuff to do. Some of the projects I worked on last week:

Homepage

Since last week it's possible to deploy my homepage to staging using the new Wagtail-backed django-cast. I start to wonder how much effort it will be to migrate the content. In the old system, blog posts are just plain Django templates that are stored in the database and will be rendered upon request. This works fine but only if you fully trust the content editors, since they can inject arbitrary javascript code for example. But I want to use it to build a SaaS product and this would make it rather unpleasant I guess. In the new django-cast version I'll use the Wagtail CMS editor which should be safe to use for untrusted editors.

But now I need to convert all my template-based content to StreamField. Which seemed difficult at first, but then my lack of HTML knowledge saved the day: just throwing my old HTML content into a RichTextBlock living in a StreamField worked surprisingly well (see this: from legacy to wagtail conversion notebook). Seems like I can get away with just converting my custom template tags for images, galleries, videos and audio into proper StreamField blocks and keeping the rest of the html basically as it was. Sweet.


Django-Cast

Added a DELETE_WAGTAIL_IMAGES setting to be able to deactivate wagtail delete images physically to be able to test migrations.
This only works if cast happens to be placed behind wagtail in INSTALLED_APPS since Django has no way to call a function after all apps were installed. Video posters do now work with wagtail videos. The gallery modal now also works on the blog list page and not only on the post detail page.

django-template

Articles


Twitter

Weeknotes

Software

Books

Videos


Podcasts


Out of Context Images

Return to blog