Day 22 Dev Notes

Just a small change tonight to keep my streak going. I added a post_content template tag with a simple test, and all worked fine.

Most of my spare time today was spent playing with the new 3D printer.

Read more

Posted on May 15, 2024 by

Categories: Development

Day 21 Dev Notes

Another small change tonight. I added a post_date tag which simply returns the date, and also tweaked the post_author tag to include some simple HTML.

Read more

Posted on May 14, 2024 by

Categories: Development

Day 20 Dev Notes

More template tags and more template refactoring tonight.

I created a post_date_link tag that displays a nicely rendered date with links to each of the date archives sections.

Read more

Posted on May 13, 2024 by

Categories: Development

Day 19 Dev Notes

Tonight, I created a couple of custom template tags that can be used to display an author link and a category link. These tags first check if the respective options are enabled, and if they are, they return nicely formatted links.

Read more

Posted on May 12, 2024 by

Categories: Development

Day 18 Dev Notes

More work on the DJPress URL structure tonight. It's slowly taking shape as I work it all out.

Read more

Posted on May 11, 2024 by

Categories: Development

Day 17 Dev Notes

Did some more work on the mortgage tools app, with some form changes and tweaks to the scenario calculator. This was a good reminder of how Django forms work; it's been ages since I got down in the weeds with Django forms.

Recently I've just used crispy-forms to take care of the styling, but I took this opportunity to see how much work is involved in styling forms without the helper package. I think for a simple form like this with just 5 fields, it's not too bad. But crispy-forms is definitely the easier option.

Read more

Posted on May 10, 2024 by

Categories: Development

Day 16 Dev Notes

I didn't post any code on the 9th May, but I did launch a whole new project after my last post about updating "My Django X", so I'm going to claim that as keeping my streak alive.

After that post, I wanted to see how quickly I could spin up a functioning project, so I took something I had been playing with in Excel and converted it into a Django app. This formed the start of a new project called "Mortgage Tools".

We will need to be making some decisions about mortgage rates soon, and I had been working on a calculator to compare scenarios. For example, let's say I could lock in a 24-month fixed rate at 6.75% today, or, I could get a higher rate of 7.29% for 12 months with the hope of the rate dropping in the future. The question is, what would the rate have to drop by to make it worthwhile.

This is the first calculator on the project, but now that I have it set up, I will add a bunch of other related calculators to help make these decisions.

But while this is going to be super useful, the main aim was to see how quickly I could spin up a project using the mydjangox template. And I'm happy to say this was really quick and easy. The challenge now is to keep the template project up to date so that I can keep it useful.

Read more

Posted on May 9, 2024 by

Categories: Development

Day 15 Dev Notes

I continued thinking about the URL matching for djpress but didn't actually write any code for this. Unless, if you count playing with regular expressions, "writing code".

Instead, I took some time out to update my MyDjangoX project, which is inspired by Will Vincent's DjangoX project.

Read more

Posted on May 8, 2024 by

Categories: Development

Day 14 Dev Notes

More work on the URL structure. It's getting there, but is way more complicated than I'd like.

Still moving forward...

Read more

Posted on May 7, 2024 by

Categories: Development

Day 13 Dev Notes

Big update to the URL structure this evening. I'll write more soon, but it's late now...

Read more

Posted on May 6, 2024 by

Categories: Development

Day 12 Dev Notes

Just some tweaking of the PostHog integration this evening. Yesterday, I added the PostHog configuration and set it up so that the API key is loaded from the environment variables. But silly me - I forgot to add the environment variables to the Docker configuration, so they weren't being loaded into the app.

Today, I added the JavaScript integration to the Bus Times app. Still not sure what value it will add, but it's interesting to play with this stuff. Adding the JavaScript snippet posed a new challenge - I needed to include the API key in the JavaScript code, but I didn't want to hard code this in the template, and I didn't want to modify all the views to pass the key in the context. So with some help from my AI friends, I created a context processor, which isn't something I've used before in Django.

Read more

Posted on May 5, 2024 by

Categories: Development

Day 11 Dev Notes

Just one minor change today. After listening to the latest episode of Django Chat, I decided to try out PostHog after a recommendation from Michael Kennedy.

I set up an account and installed the snippet on my Bus Times app. Still not sure if this will bring value, but the basic service is free and so I can try out and see what I think.

Read more

Posted on May 4, 2024 by

Categories: Development

Day 10 Dev Notes

More refactoring again, renaming contentto postin various part of the code. I also made a couple of small functional changes:

Read more

Posted on May 3, 2024 by

Categories: Development

Day 9 Dev Notes

Continuing to tweak the djpress package with the intention of moving into a standalone package. I thought I would start on moving it tonight, but I quickly realised that the packaging landscape is full of differing opinions and I need to do some more research on how best to do this.

The following two links seem to mostly agree with each other, so I will probably start with these:

But I also need to see how tools like Hatch, Flit, and others fit into the mix. Or perhaps that's overcomplicating things. Let's see.

Read more

Posted on May 2, 2024 by

Categories: Development

Day 8 Dev Notes

OK, this is starting to take shape. At least in my head it is.

I've decided to separate out the djpress package into a standalone package and will eventually publish it to PyPi. I've also refactored a lot of code, and now I'm starting to work out what I want from this package.

Read more

Posted on May 1, 2024 by

Categories: Development

Day 7 Dev Notes

The problem with architecting on the fly, is that it requires a lot of re-work as you work through the design of the solution and have to fix up previously written code. That's the issue I'm dealing with here, but this is all part of the learning experience.

I noticed some caching issues with the posts yesterday, after I was playing around with publishing future posts. This was caused by using the built-in local memory cache in Django, which is process-specific. I didn't really comprehend what this meant until I thought it through as part of my troubleshooting. The problem can occur when using multiple Gunicorn workers, since each one starts up its own process and thus has its own local memory cache. The impact of this is that each process could have a different cache depending on when the cache was set, and then on each page refresh you could see different posts depending on which process you're accessing.

Read more

Posted on Apr 30, 2024 by

Categories: Development

Day 6 Dev Notes

This morning, I wanted to implement a simple, category-based, menu in the navbar. As with most things, this was simple to implement, but I then spent some time optimising it, which lead me down an interesting pathway. Here's what I accomplished...

Read more

Posted on Apr 29, 2024 by

Categories: Development

Day 5 Dev Notes

So far, so good - 5 days in a row! 👍

Just minor tweaks again today, since today was spent working in the garden and then playing golf.

Read more

Posted on Apr 28, 2024 by

Categories: Development

Day 4 Dev Notes

Just a small tweak today. I still wasn't happy with the truncated posts because there was no indication that the post had been truncated when viewing it on the home page. To fix this, I added a boolean property to the Content model to indicate if a post had been truncated, and then added a "Read more" link.

The other small tweak I made was to move the `

Read more

Posted on Apr 27, 2024 by

Categories: Development

Auckland Photo from Hotel Room

Here's the view from our room at the Holiday Inn Express in Auckland. This is a great hotel: reasonably priced rooms which are modern, new, and clean. And it includes a great buffet breakfast too.

Read more

Posted on Apr 26, 2024 by

Categories: General

1 2 4