I finally implemented the archive feature. It's basic and I haven't made any attempt at making it pretty.
My first struggle was after querying the database for a list of all the years, how to remove duplicates. I wanted a unique list - I couldn't figure this out myself and a friendly internet stranger on stackoverflow came to my rescue, thus the generate_unique_list() function was created. I really struggled to render the blog posts for the individual months. Again, some random Internet human with one line solved my problems.
Once I had got the ids for blog posts in a month, I put them into a list and it turns out sqlalchemy has a feature to use this list to fetch the required posts. The keyword _in() saved my bacon. Hurray.
Now I can focus on Open University. I begin a module titled "Object Oriented Java Programming" and a few months later a Cyber Security module, so I will be busy, thus this blog will remain ugly, but functional. Ta.
My next small challenge is implementing a post archive page. Initially I thought this would be trivial but on further thought it requires that I first get a list of all the post timestamps. Then I must group those timestamps by month and year, and this should be output accordingly and it should work for years to come, complete with pagination.
I realise that I can probably find a number of examples online, and I may even need to consult stackoverflow for snippets or ideas, however as a challenge to myself I would like to implement the feature as much as possible with my own logic.
I will go ahead and think about this until I think elsewhere.
This is a work in progress, it's very basic but hopefully I can build upon it in time.
I want it to be a place where I can document my learning experience as I put myself through the Open University.