Daily Dev Notes 2024/09/19
After a bit of a hiatus and time off due to appendicitis and just being busy in general, I'm back with a Dev Notes post!
After a bit of a hiatus and time off due to appendicitis and just being busy in general, I'm back with a Dev Notes post!
Earlier today, I watched Simon Willison's keynote from PyConUS, and found myself nodding in agreement at pretty much everything he said.
I've been making extensive use of my "AI friends" over the last few months, switching between Google's Gemini, OpenAI's ChatGPT, Perplexity's AI search engine, Inflection AI's Pi, Microsoft's Copilot (both in Bing as well as extensively in VS Code with Github Copilot), and Anthropic's Claude.ai. I mention Anthropic last, because this is my new favourite! The new Claude 3.5 Sonnet is genuinely incredible and feels like it's a step ahead of the rest.
More documentation of the template tags. And during my documentation, I decided to change the Category model to be more consistent with the Post model. This required a migration change and a bunch of refactoring, so I bumped the version.
Started the long process of documenting everything I've done so far, starting with the template tags. There are 24 template tags so far, and I've now documented the first three!
Just did some minor tweaks on the styling on this site today. I really enjoy playing with modern CSS - it's so easy to make simple but complex (if that makes sense) changes. Also, having GitHub Copilot in VS Code makes this even easier. Now, when this site is viewed on mobile, there are no more overlapping elements that overflow into the margins.
Just a few minor updates this evening. HTMX v2 was released, so I updated this on the Bus Times app and on this blog. It was pretty straight-forward since the major breaking change related to the hx-on
tag which I wasn't using anywhere.
I added a new utility to the site tonight: the Markdown editor I had created with Pyscript. This gave me some ideas about adding new Markdown extensions to the editor. But to make this work, I had to push an update to DJ Press to allow custom extension configs.
Refactored the pagination links today in DJ Press, and then added some new ones to give some more flexibility. I've always had a goal with this package to be able to create fairly complex templates without needing to understand the models or the context being sent by the views.
Pushed a new update to the DJ Press package tonight, with the two key features being pages and template hierarchy.
I caught up on the development I've done this week on DJ Press but running the Coverage reports and catching up on missing tests. I'm really enjoying testing at the moment - something we feels like a chore at first, becomes really satisfying when the testing improves the quality of the code too.
Continued work on the Pages support. Starting to look better, especially after I got the tests all working again. Now I have to go through the Coverage reports again and get the coverage back up to 100%.
More work on the pages tonight. I wanted to be able to create a menu of the pages somewhere on the page. So I first added a menu_order
field to the Posts table, and then added some template tags to get the pages, sort them by menu_order first, and then by title second.
Tested it out and it all seemed to work OK, but more refactoring required.
First crack at static pages tonight. It's a bit rough around the edges but worked OK.
Not too happy with it right now, so will hold off committing code until I can figure it out. But so far I have:
{% page_link "about" outer="li" %}
post_detail
view to first look for a matching page before trying to get the post.OK, made some good progress tonight. Refactored the post
and posts
contexts for all the views, and then had to update the tests to match.
Then I had my first crack at implementing template hierarchy. Again, inspired by the old WordPress template files.
No coding today, but lots of thinking about the template tags.
I think I'm happy with the approach I settled on yesterday, but want to give it some more thought.
Still working on the template tags for DJ Press. I realised that in taking inspiration from WordPress, I'm unnecessarily complicating things in the templates. So I'm now moving some of the logic back to the views in order to simplify things.
I pushed an update to DJ Press and then incorporated the changes into this site. It was a breaking change, so I had to tweak the template tags to make it work. This has highlighted some further changes I need to make to the tags.
Finally managed to get around to implementing Pagination. This was the first time in a long time that I've had to implement pagination, so I was pretty much starting from scratch.
More work on the template tags tonight. I'm getting closer to my goal of having a similar template structure to the old WordPress Classic blogs. In particular, I'm using this template file as my inspiration: https://themes.svn.wordpress.org/classic/1.6/index.php
Did some work on the post_content
template tag. I changed it so that if it detects there's a Posts
object in the context, it will show the truncated post by default.