Daily Dev Notes 2024/06/15

Pushed a new update to the DJ Press package tonight, with the two key features being pages and template hierarchy.

    template_names: list[str] = [
        "djpress/home.html",
        "djpress/index.html",
    ]

This is still pretty rough, and still needs some further testing with some real templates, but it works for now. A more useful hierarchy, which I'm already using on this site, is for the post_detail view which uses the following hierarchy:

    template_names: list[str] = [
        "djpress/single.html",
        "djpress/index.html",
    ]

With this approach, you can use a completely different template file for single posts, rather than trying to incorporate this logic in the index.html template, which is what I was doing previously. Of course, I realised I now need a way to use a different template for a page, because at the moment they are displayed as blog posts, which isn't what I wanted.

So with those two new features, I pushed the 0.6.0 version of DJ Press to PyPI, and then incorporated the changes into this site.

I had to update a bunch of templates to use the new template tags, and I took that opportunity to incorporate the Pico CSS Framework(), instead of Bootstrap, which is what I was using before. It's a nice, simple, CSS framework with just enough components and styles to get you going. I'm thinking of using that in the example template included with DJ Press, but will think about that first.

And now that I had pages support on the blog, I created a Utilities page which links to the new timezone converter that I just created. This is a simple HTMX app that takes an ISO 8601 formatted timestamp and converts it to a specific timezone. This is something I need often, and it's nice to have my own little utility app to do this.

Everything is starting to take shape nicely and am really enjoying this. Soon I will need to start writing docs for everything I've created, because right now I need to hunt around the source code to figure out how to use the template tags I've created!